Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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 ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading