#region in axml file for xamarin.android












0















hello I am trying to make my code in the axml file more readable I have a lot of switches in my program and I want to shrink this part of the code. I read something about it and I found



<!--#region Name-->
My Code
<!--#endregion-->


But it is referred as a normal comment. Could you help me out? I am using Visual Studio 2017 in case it is important to mention.










share|improve this question



























    0















    hello I am trying to make my code in the axml file more readable I have a lot of switches in my program and I want to shrink this part of the code. I read something about it and I found



    <!--#region Name-->
    My Code
    <!--#endregion-->


    But it is referred as a normal comment. Could you help me out? I am using Visual Studio 2017 in case it is important to mention.










    share|improve this question

























      0












      0








      0








      hello I am trying to make my code in the axml file more readable I have a lot of switches in my program and I want to shrink this part of the code. I read something about it and I found



      <!--#region Name-->
      My Code
      <!--#endregion-->


      But it is referred as a normal comment. Could you help me out? I am using Visual Studio 2017 in case it is important to mention.










      share|improve this question














      hello I am trying to make my code in the axml file more readable I have a lot of switches in my program and I want to shrink this part of the code. I read something about it and I found



      <!--#region Name-->
      My Code
      <!--#endregion-->


      But it is referred as a normal comment. Could you help me out? I am using Visual Studio 2017 in case it is important to mention.







      xamarin.android






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 15:01









      Georgi YakovGeorgi Yakov

      188




      188
























          1 Answer
          1






          active

          oldest

          votes


















          0















          # region in axml file for xamarin.android




          If you want to make the .axml file more readable, you could click the indent button: Effect.





          Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:



          <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/titlebar_bg"
          tools:showIn="@layout/activity_main" >

          <ImageView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/gafricalogo" />
          </FrameLayout>


          Use it in another layout file:



          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/app_bg"
          android:gravity="center_horizontal">

          <include layout="@layout/titlebar"/>

          <TextView android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:padding="10dp" />

          ...

          </LinearLayout>


          Update:



          I think the XAML Regions is what you are looking in your .axml file.



          Update 2:



          Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your



          <!-- Region (Any Text You Want) --> 
          Your Code
          <!-- EndRegion -->





          share|improve this answer


























          • My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

            – Georgi Yakov
            Nov 21 '18 at 9:52













          • Do you understand what I mean?

            – Georgi Yakov
            Nov 21 '18 at 9:56











          • @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

            – York Shen - MSFT
            Nov 21 '18 at 10:11













          • @GeorgiYakov, have you checked my answer?

            – York Shen - MSFT
            Nov 28 '18 at 9:15











          • Yeah, I saw it but maybe I'm too stupid and it didn't work :)

            – Georgi Yakov
            Nov 29 '18 at 13:41











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395818%2fregion-in-axml-file-for-xamarin-android%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0















          # region in axml file for xamarin.android




          If you want to make the .axml file more readable, you could click the indent button: Effect.





          Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:



          <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/titlebar_bg"
          tools:showIn="@layout/activity_main" >

          <ImageView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/gafricalogo" />
          </FrameLayout>


          Use it in another layout file:



          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/app_bg"
          android:gravity="center_horizontal">

          <include layout="@layout/titlebar"/>

          <TextView android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:padding="10dp" />

          ...

          </LinearLayout>


          Update:



          I think the XAML Regions is what you are looking in your .axml file.



          Update 2:



          Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your



          <!-- Region (Any Text You Want) --> 
          Your Code
          <!-- EndRegion -->





          share|improve this answer


























          • My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

            – Georgi Yakov
            Nov 21 '18 at 9:52













          • Do you understand what I mean?

            – Georgi Yakov
            Nov 21 '18 at 9:56











          • @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

            – York Shen - MSFT
            Nov 21 '18 at 10:11













          • @GeorgiYakov, have you checked my answer?

            – York Shen - MSFT
            Nov 28 '18 at 9:15











          • Yeah, I saw it but maybe I'm too stupid and it didn't work :)

            – Georgi Yakov
            Nov 29 '18 at 13:41
















          0















          # region in axml file for xamarin.android




          If you want to make the .axml file more readable, you could click the indent button: Effect.





          Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:



          <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/titlebar_bg"
          tools:showIn="@layout/activity_main" >

          <ImageView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/gafricalogo" />
          </FrameLayout>


          Use it in another layout file:



          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/app_bg"
          android:gravity="center_horizontal">

          <include layout="@layout/titlebar"/>

          <TextView android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:padding="10dp" />

          ...

          </LinearLayout>


          Update:



          I think the XAML Regions is what you are looking in your .axml file.



          Update 2:



          Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your



          <!-- Region (Any Text You Want) --> 
          Your Code
          <!-- EndRegion -->





          share|improve this answer


























          • My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

            – Georgi Yakov
            Nov 21 '18 at 9:52













          • Do you understand what I mean?

            – Georgi Yakov
            Nov 21 '18 at 9:56











          • @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

            – York Shen - MSFT
            Nov 21 '18 at 10:11













          • @GeorgiYakov, have you checked my answer?

            – York Shen - MSFT
            Nov 28 '18 at 9:15











          • Yeah, I saw it but maybe I'm too stupid and it didn't work :)

            – Georgi Yakov
            Nov 29 '18 at 13:41














          0












          0








          0








          # region in axml file for xamarin.android




          If you want to make the .axml file more readable, you could click the indent button: Effect.





          Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:



          <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/titlebar_bg"
          tools:showIn="@layout/activity_main" >

          <ImageView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/gafricalogo" />
          </FrameLayout>


          Use it in another layout file:



          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/app_bg"
          android:gravity="center_horizontal">

          <include layout="@layout/titlebar"/>

          <TextView android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:padding="10dp" />

          ...

          </LinearLayout>


          Update:



          I think the XAML Regions is what you are looking in your .axml file.



          Update 2:



          Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your



          <!-- Region (Any Text You Want) --> 
          Your Code
          <!-- EndRegion -->





          share|improve this answer
















          # region in axml file for xamarin.android




          If you want to make the .axml file more readable, you could click the indent button: Effect.





          Or you could use the <include/> tag embed another layout inside the current layout to make it more readable. For example, create a titlebar.axml:



          <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@color/titlebar_bg"
          tools:showIn="@layout/activity_main" >

          <ImageView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/gafricalogo" />
          </FrameLayout>


          Use it in another layout file:



          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/app_bg"
          android:gravity="center_horizontal">

          <include layout="@layout/titlebar"/>

          <TextView android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello"
          android:padding="10dp" />

          ...

          </LinearLayout>


          Update:



          I think the XAML Regions is what you are looking in your .axml file.



          Update 2:



          Install this plugin for your Visual Studio, close all your Visual Studio windows and reopen the VS. Then, you could the the #Region function for your



          <!-- Region (Any Text You Want) --> 
          Your Code
          <!-- EndRegion -->






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 29 '18 at 14:25

























          answered Nov 21 '18 at 2:38









          York Shen - MSFTYork Shen - MSFT

          6,8611325




          6,8611325













          • My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

            – Georgi Yakov
            Nov 21 '18 at 9:52













          • Do you understand what I mean?

            – Georgi Yakov
            Nov 21 '18 at 9:56











          • @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

            – York Shen - MSFT
            Nov 21 '18 at 10:11













          • @GeorgiYakov, have you checked my answer?

            – York Shen - MSFT
            Nov 28 '18 at 9:15











          • Yeah, I saw it but maybe I'm too stupid and it didn't work :)

            – Georgi Yakov
            Nov 29 '18 at 13:41



















          • My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

            – Georgi Yakov
            Nov 21 '18 at 9:52













          • Do you understand what I mean?

            – Georgi Yakov
            Nov 21 '18 at 9:56











          • @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

            – York Shen - MSFT
            Nov 21 '18 at 10:11













          • @GeorgiYakov, have you checked my answer?

            – York Shen - MSFT
            Nov 28 '18 at 9:15











          • Yeah, I saw it but maybe I'm too stupid and it didn't work :)

            – Georgi Yakov
            Nov 29 '18 at 13:41

















          My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

          – Georgi Yakov
          Nov 21 '18 at 9:52







          My point is that I have 32 switches in my code. I find it stupid to click on the button you are talking about for everyone of them. I wanted to specify an area that can be collapsed and hidden when I want so I can hide all of them at once.

          – Georgi Yakov
          Nov 21 '18 at 9:52















          Do you understand what I mean?

          – Georgi Yakov
          Nov 21 '18 at 9:56





          Do you understand what I mean?

          – Georgi Yakov
          Nov 21 '18 at 9:56













          @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

          – York Shen - MSFT
          Nov 21 '18 at 10:11







          @GeorgiYakov, got it, I have updated my answer, please check it. It works fine on my side.

          – York Shen - MSFT
          Nov 21 '18 at 10:11















          @GeorgiYakov, have you checked my answer?

          – York Shen - MSFT
          Nov 28 '18 at 9:15





          @GeorgiYakov, have you checked my answer?

          – York Shen - MSFT
          Nov 28 '18 at 9:15













          Yeah, I saw it but maybe I'm too stupid and it didn't work :)

          – Georgi Yakov
          Nov 29 '18 at 13:41





          Yeah, I saw it but maybe I'm too stupid and it didn't work :)

          – Georgi Yakov
          Nov 29 '18 at 13:41


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53395818%2fregion-in-axml-file-for-xamarin-android%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

          SQL update select statement

          WPF add header to Image with URL pettitions [duplicate]