LinearLayout not expanding inside a ScrollView



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








350















I have a LinearLayout inside a ScrollView that has android:layout_height="fill_parent", but it doesn't expand to the full height of the ScrollView. My layout looks something like:



level layout layout_width layout_height
1 LinearLayout fill_parent fill_parent
2 LinearLayout fill_parent wrap_content
3 (some irrelevant stuff)
2 ScrollView fill_parent fill_parent <-- this expands full height
3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4 TextView fill_parent fill_parent
4 LinearLayout fill_parent wrap_content


I can see that the LinearLayout doesn't expand the full height of the ScrollView because in Eclipse in Android Layout Editor, if I select the ScrollView (in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout its highlight doesn't expand to the bottom of the screen. How can I get it to do so?



The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout containing the button to stick to the bottom of the screen.



At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/video_layout"
android:focusable="true"
style="@style/VideoLayout">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:foreground="@android:drawable/ic_media_play"
android:foregroundGravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/video_thumb"
android:padding="5dip"
android:background="#454545"/>
</FrameLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@style/VideoTitle"
android:id="@+id/video_title"
android:layout_gravity="center"
android:layout_weight="1"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- this ScrollView expands the full height of the screen.
However, the next LinearLayout does not expand the full height of the ScrollView -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="fill"
android:orientation="vertical"
android:id="@+id/info_layout">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/info_body"
style="@style/InfoText"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@android:style/ButtonBar">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="@string/button_readmore"
android:id="@+id/btn_read_more"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>


At the moment I have resorted to android:layout_gravity="bottom" on the problematic LinearLayout, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.



Update: scratch that, android:layout_gravity="bottom" makes the ScrollView unable to, well, scroll. Other ideas?










share|improve this question






























    350















    I have a LinearLayout inside a ScrollView that has android:layout_height="fill_parent", but it doesn't expand to the full height of the ScrollView. My layout looks something like:



    level layout layout_width layout_height
    1 LinearLayout fill_parent fill_parent
    2 LinearLayout fill_parent wrap_content
    3 (some irrelevant stuff)
    2 ScrollView fill_parent fill_parent <-- this expands full height
    3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
    (following stuff probably are irrelevant, but just to be sure:)
    4 TextView fill_parent fill_parent
    4 LinearLayout fill_parent wrap_content


    I can see that the LinearLayout doesn't expand the full height of the ScrollView because in Eclipse in Android Layout Editor, if I select the ScrollView (in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout its highlight doesn't expand to the bottom of the screen. How can I get it to do so?



    The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout containing the button to stick to the bottom of the screen.



    At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.



    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/video_layout"
    android:focusable="true"
    style="@style/VideoLayout">
    <FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:foreground="@android:drawable/ic_media_play"
    android:foregroundGravity="center">
    <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/video_thumb"
    android:padding="5dip"
    android:background="#454545"/>
    </FrameLayout>
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:focusable="true"
    style="@style/VideoTitle"
    android:id="@+id/video_title"
    android:layout_gravity="center"
    android:layout_weight="1"/>
    </LinearLayout>
    <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1">
    <!-- this ScrollView expands the full height of the screen.
    However, the next LinearLayout does not expand the full height of the ScrollView -->
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:layout_gravity="fill"
    android:orientation="vertical"
    android:id="@+id/info_layout">
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/info_body"
    style="@style/InfoText"/>
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    style="@android:style/ButtonBar">
    <Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight="1"
    android:text="@string/button_readmore"
    android:id="@+id/btn_read_more"/>
    </LinearLayout>
    </LinearLayout>
    </ScrollView>
    </LinearLayout>


    At the moment I have resorted to android:layout_gravity="bottom" on the problematic LinearLayout, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.



    Update: scratch that, android:layout_gravity="bottom" makes the ScrollView unable to, well, scroll. Other ideas?










    share|improve this question


























      350












      350








      350


      71






      I have a LinearLayout inside a ScrollView that has android:layout_height="fill_parent", but it doesn't expand to the full height of the ScrollView. My layout looks something like:



      level layout layout_width layout_height
      1 LinearLayout fill_parent fill_parent
      2 LinearLayout fill_parent wrap_content
      3 (some irrelevant stuff)
      2 ScrollView fill_parent fill_parent <-- this expands full height
      3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
      (following stuff probably are irrelevant, but just to be sure:)
      4 TextView fill_parent fill_parent
      4 LinearLayout fill_parent wrap_content


      I can see that the LinearLayout doesn't expand the full height of the ScrollView because in Eclipse in Android Layout Editor, if I select the ScrollView (in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout its highlight doesn't expand to the bottom of the screen. How can I get it to do so?



      The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout containing the button to stick to the bottom of the screen.



      At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.



      <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      xmlns:android="http://schemas.android.com/apk/res/android">
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:id="@+id/video_layout"
      android:focusable="true"
      style="@style/VideoLayout">
      <FrameLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:foreground="@android:drawable/ic_media_play"
      android:foregroundGravity="center">
      <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/video_thumb"
      android:padding="5dip"
      android:background="#454545"/>
      </FrameLayout>
      <TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:focusable="true"
      style="@style/VideoTitle"
      android:id="@+id/video_title"
      android:layout_gravity="center"
      android:layout_weight="1"/>
      </LinearLayout>
      <ScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1">
      <!-- this ScrollView expands the full height of the screen.
      However, the next LinearLayout does not expand the full height of the ScrollView -->
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1"
      android:layout_gravity="fill"
      android:orientation="vertical"
      android:id="@+id/info_layout">
      <TextView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:id="@+id/info_body"
      style="@style/InfoText"/>
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      style="@android:style/ButtonBar">
      <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:layout_weight="1"
      android:text="@string/button_readmore"
      android:id="@+id/btn_read_more"/>
      </LinearLayout>
      </LinearLayout>
      </ScrollView>
      </LinearLayout>


      At the moment I have resorted to android:layout_gravity="bottom" on the problematic LinearLayout, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.



      Update: scratch that, android:layout_gravity="bottom" makes the ScrollView unable to, well, scroll. Other ideas?










      share|improve this question
















      I have a LinearLayout inside a ScrollView that has android:layout_height="fill_parent", but it doesn't expand to the full height of the ScrollView. My layout looks something like:



      level layout layout_width layout_height
      1 LinearLayout fill_parent fill_parent
      2 LinearLayout fill_parent wrap_content
      3 (some irrelevant stuff)
      2 ScrollView fill_parent fill_parent <-- this expands full height
      3 LinearLayout fill_parent fill_parent <-- this does not (has orientation=vertical)
      (following stuff probably are irrelevant, but just to be sure:)
      4 TextView fill_parent fill_parent
      4 LinearLayout fill_parent wrap_content


      I can see that the LinearLayout doesn't expand the full height of the ScrollView because in Eclipse in Android Layout Editor, if I select the ScrollView (in the Outline panel) it is highlighted with a red border that fills the screen to the bottom but when I select the LinearLayout its highlight doesn't expand to the bottom of the screen. How can I get it to do so?



      The effect I'm trying to achieve is to have some text and a button below it (inside the LinearLayout in level 4 there's just a button). The text can be big enough to need a scrollbar, in which case I want the user to have to scroll down in order to see the button. In case the text is not big enough for a scroll bar, I want the LinearLayout containing the button to stick to the bottom of the screen.



      At first I thought I shouldn't post the full XML because it's usually a turn-down to see a huge chunk of code in a question. However, it seems it might be necessary, so here's the full layout.



      <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      xmlns:android="http://schemas.android.com/apk/res/android">
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      android:id="@+id/video_layout"
      android:focusable="true"
      style="@style/VideoLayout">
      <FrameLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:foreground="@android:drawable/ic_media_play"
      android:foregroundGravity="center">
      <ImageView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/video_thumb"
      android:padding="5dip"
      android:background="#454545"/>
      </FrameLayout>
      <TextView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:focusable="true"
      style="@style/VideoTitle"
      android:id="@+id/video_title"
      android:layout_gravity="center"
      android:layout_weight="1"/>
      </LinearLayout>
      <ScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1">
      <!-- this ScrollView expands the full height of the screen.
      However, the next LinearLayout does not expand the full height of the ScrollView -->
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:layout_weight="1"
      android:layout_gravity="fill"
      android:orientation="vertical"
      android:id="@+id/info_layout">
      <TextView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:id="@+id/info_body"
      style="@style/InfoText"/>
      <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      style="@android:style/ButtonBar">
      <Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center"
      android:layout_weight="1"
      android:text="@string/button_readmore"
      android:id="@+id/btn_read_more"/>
      </LinearLayout>
      </LinearLayout>
      </ScrollView>
      </LinearLayout>


      At the moment I have resorted to android:layout_gravity="bottom" on the problematic LinearLayout, which makes the button stick to the bottom of the screen no matter what. But that also makes the text stick to the bottom of the screen, which is not exactly what I was after.



      Update: scratch that, android:layout_gravity="bottom" makes the ScrollView unable to, well, scroll. Other ideas?







      android android-layout






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 9 '10 at 9:53







      Felix

















      asked Apr 8 '10 at 12:38









      FelixFelix

      64.2k38137162




      64.2k38137162






















          6 Answers
          6






          active

          oldest

          votes


















          925














          Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).



          The solution was to use android:fillViewport="true" on the ScrollView.






          share|improve this answer


















          • 4





            Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

            – Paul Lammertsma
            Sep 11 '13 at 8:50











          • This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

            – Ashok Chakravarthi
            Dec 29 '14 at 7:16











          • not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

            – Prasad
            Mar 13 '15 at 10:02






          • 3





            So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

            – MyWay
            Sep 15 '15 at 20:40











          • @Prasad make your height of linear layout to match parent

            – goonerDroid
            Oct 13 '15 at 10:55


















          17














          I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard.
          Use Relative layout instead of LinearLayout it solves the purpose.






          share|improve this answer






























            8














            Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.



            You might have to set



            android:layout_weight="1"


            for the item that you want expanded






            share|improve this answer


















            • 1





              Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

              – Felix
              Apr 9 '10 at 9:45


















            2














            I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.



            LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.






            share|improve this answer























            • But this solution makes the xml more complicated, and takes more time to inflate.

              – twlkyao
              Aug 19 '15 at 9:07


















            1














            In my case i haven't given the




            orientation of LinearLayout(ScrollView's Child)




            So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).




            This was my case hopes it helps somebody




            .






            share|improve this answer






























              0














              The solution is to use



              android:fillViewport="true"



              on Scroll view and moreover try to use



              "wrap_content" instead of "fill_parent" as "fill_parent"



              is deprecated now.






              share|improve this answer























                protected by Felix Dec 13 '12 at 9:58



                Thank you for your interest in this question.
                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                Would you like to answer one of these unanswered questions instead?














                6 Answers
                6






                active

                oldest

                votes








                6 Answers
                6






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                925














                Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).



                The solution was to use android:fillViewport="true" on the ScrollView.






                share|improve this answer


















                • 4





                  Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                  – Paul Lammertsma
                  Sep 11 '13 at 8:50











                • This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                  – Ashok Chakravarthi
                  Dec 29 '14 at 7:16











                • not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                  – Prasad
                  Mar 13 '15 at 10:02






                • 3





                  So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                  – MyWay
                  Sep 15 '15 at 20:40











                • @Prasad make your height of linear layout to match parent

                  – goonerDroid
                  Oct 13 '15 at 10:55















                925














                Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).



                The solution was to use android:fillViewport="true" on the ScrollView.






                share|improve this answer


















                • 4





                  Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                  – Paul Lammertsma
                  Sep 11 '13 at 8:50











                • This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                  – Ashok Chakravarthi
                  Dec 29 '14 at 7:16











                • not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                  – Prasad
                  Mar 13 '15 at 10:02






                • 3





                  So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                  – MyWay
                  Sep 15 '15 at 20:40











                • @Prasad make your height of linear layout to match parent

                  – goonerDroid
                  Oct 13 '15 at 10:55













                925












                925








                925







                Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).



                The solution was to use android:fillViewport="true" on the ScrollView.






                share|improve this answer













                Found the solution myself in the end. The problem was not with the LinearLayout, but with the ScrollView (seems weird, considering the fact that the ScrollView was expanding, while the LinearLayout wasn't).



                The solution was to use android:fillViewport="true" on the ScrollView.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 9 '10 at 10:29









                FelixFelix

                64.2k38137162




                64.2k38137162







                • 4





                  Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                  – Paul Lammertsma
                  Sep 11 '13 at 8:50











                • This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                  – Ashok Chakravarthi
                  Dec 29 '14 at 7:16











                • not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                  – Prasad
                  Mar 13 '15 at 10:02






                • 3





                  So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                  – MyWay
                  Sep 15 '15 at 20:40











                • @Prasad make your height of linear layout to match parent

                  – goonerDroid
                  Oct 13 '15 at 10:55












                • 4





                  Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                  – Paul Lammertsma
                  Sep 11 '13 at 8:50











                • This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                  – Ashok Chakravarthi
                  Dec 29 '14 at 7:16











                • not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                  – Prasad
                  Mar 13 '15 at 10:02






                • 3





                  So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                  – MyWay
                  Sep 15 '15 at 20:40











                • @Prasad make your height of linear layout to match parent

                  – goonerDroid
                  Oct 13 '15 at 10:55







                4




                4





                Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                – Paul Lammertsma
                Sep 11 '13 at 8:50





                Note that the LinearLayout will expand vertically, but this may not necessarily be reflected in your layout unless it contains a control that consumes that additional space using android:weight.

                – Paul Lammertsma
                Sep 11 '13 at 8:50













                This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                – Ashok Chakravarthi
                Dec 29 '14 at 7:16





                This really helps. Thanks for that. But without this code sometimes works good. Do you know why?

                – Ashok Chakravarthi
                Dec 29 '14 at 7:16













                not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                – Prasad
                Mar 13 '15 at 10:02





                not working for <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:fillViewport="true" android:background="#000" android:orientation="vertical" > </LinearLayout>

                – Prasad
                Mar 13 '15 at 10:02




                3




                3





                So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                – MyWay
                Sep 15 '15 at 20:40





                So sick I was sitting for hours and searching whats wrong with my code. For what this paramater? When you would ever like to set it false?

                – MyWay
                Sep 15 '15 at 20:40













                @Prasad make your height of linear layout to match parent

                – goonerDroid
                Oct 13 '15 at 10:55





                @Prasad make your height of linear layout to match parent

                – goonerDroid
                Oct 13 '15 at 10:55













                17














                I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard.
                Use Relative layout instead of LinearLayout it solves the purpose.






                share|improve this answer



























                  17














                  I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard.
                  Use Relative layout instead of LinearLayout it solves the purpose.






                  share|improve this answer

























                    17












                    17








                    17







                    I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard.
                    Use Relative layout instead of LinearLayout it solves the purpose.






                    share|improve this answer













                    I know this post is very old, For those who don't want to use android:fillViewport="true" because it sometimes doesn't bring up the edittext above keyboard.
                    Use Relative layout instead of LinearLayout it solves the purpose.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Sep 14 '15 at 7:12









                    Hardik4560Hardik4560

                    2,6761429




                    2,6761429





















                        8














                        Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.



                        You might have to set



                        android:layout_weight="1"


                        for the item that you want expanded






                        share|improve this answer


















                        • 1





                          Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                          – Felix
                          Apr 9 '10 at 9:45















                        8














                        Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.



                        You might have to set



                        android:layout_weight="1"


                        for the item that you want expanded






                        share|improve this answer


















                        • 1





                          Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                          – Felix
                          Apr 9 '10 at 9:45













                        8












                        8








                        8







                        Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.



                        You might have to set



                        android:layout_weight="1"


                        for the item that you want expanded






                        share|improve this answer













                        Can you provide your layout xml? Doing so would allow people to recreate the issue with minimal effort.



                        You might have to set



                        android:layout_weight="1"


                        for the item that you want expanded







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Apr 8 '10 at 13:09









                        snctlnsnctln

                        11.4k53940




                        11.4k53940







                        • 1





                          Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                          – Felix
                          Apr 9 '10 at 9:45












                        • 1





                          Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                          – Felix
                          Apr 9 '10 at 9:45







                        1




                        1





                        Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                        – Felix
                        Apr 9 '10 at 9:45





                        Thank you for your answer. I tried your suggestion but it didn't work. I also updated my question to include the layout xml.

                        – Felix
                        Apr 9 '10 at 9:45











                        2














                        I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.



                        LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.






                        share|improve this answer























                        • But this solution makes the xml more complicated, and takes more time to inflate.

                          – twlkyao
                          Aug 19 '15 at 9:07















                        2














                        I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.



                        LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.






                        share|improve this answer























                        • But this solution makes the xml more complicated, and takes more time to inflate.

                          – twlkyao
                          Aug 19 '15 at 9:07













                        2












                        2








                        2







                        I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.



                        LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.






                        share|improve this answer













                        I have dynamically used to get this . I have a LinearLayout and within this used ScrollView as a child. Then i take again LinearLayout and add what ever View u want to this LinearLayout and then this LinearLayout add to ScrollView and finally add this ScrollView to LinearLayout. Then u can get scroll in ur ScrollView and nothing will left to visible.



                        LinearLayout(Parent)--ScrollView(child of LinerLayout) -- LinearLayout(child of ScrollView)-- add here textView, Buttons , spinner etc whatever u want . Then add this LinearLyout to ScrollView. Bcoz only one CHILD for ScrollView applicable and last add this ScrollView to LinearLyout.If defined area is exceed from Screen size then u will get a Scroll within ScrollView.







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Dec 9 '10 at 18:58









                        BrajBraj

                        291




                        291












                        • But this solution makes the xml more complicated, and takes more time to inflate.

                          – twlkyao
                          Aug 19 '15 at 9:07

















                        • But this solution makes the xml more complicated, and takes more time to inflate.

                          – twlkyao
                          Aug 19 '15 at 9:07
















                        But this solution makes the xml more complicated, and takes more time to inflate.

                        – twlkyao
                        Aug 19 '15 at 9:07





                        But this solution makes the xml more complicated, and takes more time to inflate.

                        – twlkyao
                        Aug 19 '15 at 9:07











                        1














                        In my case i haven't given the




                        orientation of LinearLayout(ScrollView's Child)




                        So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).




                        This was my case hopes it helps somebody




                        .






                        share|improve this answer



























                          1














                          In my case i haven't given the




                          orientation of LinearLayout(ScrollView's Child)




                          So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).




                          This was my case hopes it helps somebody




                          .






                          share|improve this answer

























                            1












                            1








                            1







                            In my case i haven't given the




                            orientation of LinearLayout(ScrollView's Child)




                            So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).




                            This was my case hopes it helps somebody




                            .






                            share|improve this answer













                            In my case i haven't given the




                            orientation of LinearLayout(ScrollView's Child)




                            So by default it takes horizontal, but scrollview scrols vertically, so please check if 'android:orientation="vertical"' is set to your ScrollView's Child(In the case of LinearLayout).




                            This was my case hopes it helps somebody




                            .







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 3 '15 at 7:47









                            Vishal PandeyVishal Pandey

                            64586




                            64586





















                                0














                                The solution is to use



                                android:fillViewport="true"



                                on Scroll view and moreover try to use



                                "wrap_content" instead of "fill_parent" as "fill_parent"



                                is deprecated now.






                                share|improve this answer





























                                  0














                                  The solution is to use



                                  android:fillViewport="true"



                                  on Scroll view and moreover try to use



                                  "wrap_content" instead of "fill_parent" as "fill_parent"



                                  is deprecated now.






                                  share|improve this answer



























                                    0












                                    0








                                    0







                                    The solution is to use



                                    android:fillViewport="true"



                                    on Scroll view and moreover try to use



                                    "wrap_content" instead of "fill_parent" as "fill_parent"



                                    is deprecated now.






                                    share|improve this answer















                                    The solution is to use



                                    android:fillViewport="true"



                                    on Scroll view and moreover try to use



                                    "wrap_content" instead of "fill_parent" as "fill_parent"



                                    is deprecated now.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Nov 16 '18 at 13:47









                                    Aniruddh Parihar

                                    2,21911129




                                    2,21911129










                                    answered Sep 21 '18 at 12:50









                                    Khushboo AggarwalKhushboo Aggarwal

                                    694




                                    694















                                        protected by Felix Dec 13 '12 at 9:58



                                        Thank you for your interest in this question.
                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                        Would you like to answer one of these unanswered questions instead?



                                        Popular posts from this blog

                                        Top Tejano songwriter Luis Silva dead of heart attack at 64

                                        政党

                                        天津地下鉄3号線