Android adapt layout height to its content until parent's height be reached

Viewed 16

I have a layout which looks like that :

 -------------
|   BUTTON 1  |
 -------------
 -------------
|  SCROLLVIEW |
 -------------
 -------------
|   BUTTON 2  |
 -------------

The content of the scrollview can grow in height dynamically. I woukd like that if the scrollview's content grows the scrollview grows too, pushing the button 2 down. But I don't want that the layout height can exceed his parent's height. If it happens the button 2 has to be aligned with the parent's bottom edge and the scrollview has to be scrolled to display its content. How can I do that with standard layout ?

1 Answers

You can use constraint layout/ Relative layout or Linear layout with weight to achieve this.

Related