LinearLayout won't fill screen












0















Having a few issues with getting my linear layout to fill the screen when testing on a tablet. On a phone it works fine but this is what happens on a tablet:



enter image description here



Here is the xml code, I have looked at suggestions for scroll view, etc but nothing has worked so far!



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">


<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvOrderNumber"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:text=""
android:textAlignment="center" />

<TextView
android:id="@+id/tvDateTime"
android:layout_width="match_parent"
android:layout_height="45dp"
android:text=""
android:gravity="center"/>

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvItemType"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text=""
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>





<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">

<TextView
android:gravity="center"
android:text="Name"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemName"
android:layout_below="@+id/textView2"/>
<TextView
android:gravity="center"
android:text="Qty"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemQty"
android:layout_below="@+id/textView2"/>
</LinearLayout>

</LinearLayout>


And this is how AndroidStudio says it will display on a 10.1" tablet



enter image description here










share|improve this question

























  • It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

    – Ben P.
    Aug 15 '18 at 20:31











  • Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

    – androidUser1993
    Aug 15 '18 at 20:42











  • For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

    – Ben P.
    Aug 15 '18 at 21:03











  • I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

    – androidUser1993
    Aug 15 '18 at 21:16











  • Possible duplicate of What does android:layout_weight mean?

    – Martin Zeitler
    Jan 1 at 15:57
















0















Having a few issues with getting my linear layout to fill the screen when testing on a tablet. On a phone it works fine but this is what happens on a tablet:



enter image description here



Here is the xml code, I have looked at suggestions for scroll view, etc but nothing has worked so far!



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">


<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvOrderNumber"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:text=""
android:textAlignment="center" />

<TextView
android:id="@+id/tvDateTime"
android:layout_width="match_parent"
android:layout_height="45dp"
android:text=""
android:gravity="center"/>

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvItemType"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text=""
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>





<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">

<TextView
android:gravity="center"
android:text="Name"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemName"
android:layout_below="@+id/textView2"/>
<TextView
android:gravity="center"
android:text="Qty"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemQty"
android:layout_below="@+id/textView2"/>
</LinearLayout>

</LinearLayout>


And this is how AndroidStudio says it will display on a 10.1" tablet



enter image description here










share|improve this question

























  • It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

    – Ben P.
    Aug 15 '18 at 20:31











  • Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

    – androidUser1993
    Aug 15 '18 at 20:42











  • For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

    – Ben P.
    Aug 15 '18 at 21:03











  • I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

    – androidUser1993
    Aug 15 '18 at 21:16











  • Possible duplicate of What does android:layout_weight mean?

    – Martin Zeitler
    Jan 1 at 15:57














0












0








0








Having a few issues with getting my linear layout to fill the screen when testing on a tablet. On a phone it works fine but this is what happens on a tablet:



enter image description here



Here is the xml code, I have looked at suggestions for scroll view, etc but nothing has worked so far!



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">


<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvOrderNumber"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:text=""
android:textAlignment="center" />

<TextView
android:id="@+id/tvDateTime"
android:layout_width="match_parent"
android:layout_height="45dp"
android:text=""
android:gravity="center"/>

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvItemType"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text=""
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>





<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">

<TextView
android:gravity="center"
android:text="Name"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemName"
android:layout_below="@+id/textView2"/>
<TextView
android:gravity="center"
android:text="Qty"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemQty"
android:layout_below="@+id/textView2"/>
</LinearLayout>

</LinearLayout>


And this is how AndroidStudio says it will display on a 10.1" tablet



enter image description here










share|improve this question
















Having a few issues with getting my linear layout to fill the screen when testing on a tablet. On a phone it works fine but this is what happens on a tablet:



enter image description here



Here is the xml code, I have looked at suggestions for scroll view, etc but nothing has worked so far!



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">


<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvOrderNumber"
android:layout_width="match_parent"
android:layout_height="45dp"
android:gravity="center"
android:text=""
android:textAlignment="center" />

<TextView
android:id="@+id/tvDateTime"
android:layout_width="match_parent"
android:layout_height="45dp"
android:text=""
android:gravity="center"/>

</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">
<TextView
android:id="@+id/tvItemType"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text=""
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>





<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="33.3">

<TextView
android:gravity="center"
android:text="Name"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemName"
android:layout_below="@+id/textView2"/>
<TextView
android:gravity="center"
android:text="Qty"
android:layout_width="match_parent"
android:layout_height="45dp"
android:id="@+id/tvItemQty"
android:layout_below="@+id/textView2"/>
</LinearLayout>

</LinearLayout>


And this is how AndroidStudio says it will display on a 10.1" tablet



enter image description here







android android-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 15:37









Cœur

18.4k9109148




18.4k9109148










asked Aug 15 '18 at 20:23









androidUser1993androidUser1993

588




588













  • It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

    – Ben P.
    Aug 15 '18 at 20:31











  • Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

    – androidUser1993
    Aug 15 '18 at 20:42











  • For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

    – Ben P.
    Aug 15 '18 at 21:03











  • I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

    – androidUser1993
    Aug 15 '18 at 21:16











  • Possible duplicate of What does android:layout_weight mean?

    – Martin Zeitler
    Jan 1 at 15:57



















  • It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

    – Ben P.
    Aug 15 '18 at 20:31











  • Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

    – androidUser1993
    Aug 15 '18 at 20:42











  • For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

    – Ben P.
    Aug 15 '18 at 21:03











  • I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

    – androidUser1993
    Aug 15 '18 at 21:16











  • Possible duplicate of What does android:layout_weight mean?

    – Martin Zeitler
    Jan 1 at 15:57

















It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

– Ben P.
Aug 15 '18 at 20:31





It looks like the layout you posted (with the three linearlayouts inside a horizontal linearlayout) must be included in some other layout. Perhaps you're using it as the layout for item views in a recyclerview? Please post the root layout (the one with the recyclerview, if I've guessed correctly).

– Ben P.
Aug 15 '18 at 20:31













Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

– androidUser1993
Aug 15 '18 at 20:42





Thanks Ben, as soon as you mentioned that I was able to figure the rest out! Still very new to android and have about 101 other issues I can't solve but you have successfully solved one for me, I really appreciate it!

– androidUser1993
Aug 15 '18 at 20:42













For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

– Ben P.
Aug 15 '18 at 21:03





For what it's worth, it would be nice to write up an answer to your own question explaining what you realized and how you fixed it, in case someone else has a similar problem in the future. And then you don't have to edit the question title to say "SOLVED" because the question will have an accepted answer.

– Ben P.
Aug 15 '18 at 21:03













I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

– androidUser1993
Aug 15 '18 at 21:16





I'll do that now Ben, thanks for the advice.. as you can tell I'm pretty new to this sort of thing!

– androidUser1993
Aug 15 '18 at 21:16













Possible duplicate of What does android:layout_weight mean?

– Martin Zeitler
Jan 1 at 15:57





Possible duplicate of What does android:layout_weight mean?

– Martin Zeitler
Jan 1 at 15:57












2 Answers
2






active

oldest

votes


















0














I cannot reproduce your error on an emulator.



Try make the inner layouts android:layout_width="0dp" and android:layout_weight="1", and remove android:weightSum="100".






share|improve this answer































    0














    You have to add landscape orientation for your app in resources and redesign layout for horizontal layout. Here is the guide






    share|improve this answer























      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%2f51865894%2flinearlayout-wont-fill-screen%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      I cannot reproduce your error on an emulator.



      Try make the inner layouts android:layout_width="0dp" and android:layout_weight="1", and remove android:weightSum="100".






      share|improve this answer




























        0














        I cannot reproduce your error on an emulator.



        Try make the inner layouts android:layout_width="0dp" and android:layout_weight="1", and remove android:weightSum="100".






        share|improve this answer


























          0












          0








          0







          I cannot reproduce your error on an emulator.



          Try make the inner layouts android:layout_width="0dp" and android:layout_weight="1", and remove android:weightSum="100".






          share|improve this answer













          I cannot reproduce your error on an emulator.



          Try make the inner layouts android:layout_width="0dp" and android:layout_weight="1", and remove android:weightSum="100".







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Aug 15 '18 at 20:33









          Xi WeiXi Wei

          8921322




          8921322

























              0














              You have to add landscape orientation for your app in resources and redesign layout for horizontal layout. Here is the guide






              share|improve this answer




























                0














                You have to add landscape orientation for your app in resources and redesign layout for horizontal layout. Here is the guide






                share|improve this answer


























                  0












                  0








                  0







                  You have to add landscape orientation for your app in resources and redesign layout for horizontal layout. Here is the guide






                  share|improve this answer













                  You have to add landscape orientation for your app in resources and redesign layout for horizontal layout. Here is the guide







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Aug 15 '18 at 20:43









                  JAGUARJAGUAR

                  116




                  116






























                      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%2f51865894%2flinearlayout-wont-fill-screen%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

                      Monofisismo

                      Angular Downloading a file using contenturl with Basic Authentication

                      Olmecas