In android, how can you create a scroll view that\'s got a max height, and wrap contents, basically it wraps the content vertically, but has a maximum height?
I trie
It can be done by wrapping the view into ConstraintLayout and using layout_constraintHeight_max
attribute.
...
In the example above, the parent ConstraintLayout
height is limited to 200dp
, and the child ScrollView
height wraps the content till it's less than 200dp
. Note that app:layout_constraintVertical_bias="0"
aligns the child ScrollView
at the top of the parent, otherwise it will be centered.