Apr 8, 2010
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:
View 2 Replies
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.
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.