Reputation: 21870
I have a LinearLayout (the content view container) inside a ScrollView. I would like the LinearLayout to have a minimum height of "match_parent" but if the content is taller than the parent, then I want the LinearLayout to be able to "wrap_content".
My LinearLayout has a tiled background image that makes it look like the background is a yellow legal pad. However, if the content in the LinearLayout is short, then I've got a black blank section at the bottom of the screen since the LinearLayout is just wrapping the content.
I want the yellow legal pad background to cover the entire screen but I can't put it on the ScrollView because then the background won't scroll along with the content. I don't want the content to float above the pad, I want them to be anchored together.
Is there any way to achieve this?
EDIT:
Further research.. the ScrollView and LinearLayout are both 683px tall, so they are both the same size, which is good. The problem though is that they should both be 766px tall (the size of the previous fragment which is being replaced by this one).
Upvotes: 21
Views: 4867
Reputation: 118
Not really sure I understand why you need this but you can add another let's say linear layout to your scroll view and give it a weight of 0 and your content linear layout can have a weight of 1 so you won't have any dark portions in the scrollview. I hope I'm making some sense :)
Upvotes: 1
Reputation: 383
The solution for the wrap_content can be: You can use weightsum for the parent linearlayout and layout weight for every child of linearlayout.
Upvotes: 0