In the attached image, I want the column of buttons to match the height of the image, but I also want there to be a minimum height for the column of buttons.
It correctly matches the height of the image, but does not respect the minHeight, and will smoosh the buttons down.
I am setting these properties for the column of buttons:
<LinearLayout ... android:layout_alignTop="@+id/image" android:layout_alignBottom="@+id/image" android:minHeight="150dp" >
The min-height property in CSS is used to set the minimum height of a specified element. The min-height property always overrides both height and max-height . Authors may use any of the length values as long as they are a positive value.
The max-content height is, roughly, the height the content would have if no “soft” line breaks were inserted, i.e., if each paragraph is one long line. The intrinsic minimum height. The min-content height is, roughly, the tallest the box can get by breaking all lines at all possible break points.
Conversation. CSS tip: To reset a min-height or min-width declaration, set it to "0", not "auto". For max-height/width, the initial value is "none".
The difference between height and min-height is that height defines a value for the height and that's how tall the element will be. min-height says that the minimum height is some value but that the element can continue to grow past that defined height if needed (like the content inside makes it taller or whatever).
I don't know all your exact requirements, but it seems you can solve this with another layer pretty much like in your diagram. Set the minHeight
on an outer layout and then just fill_parent
/match_parent
on the inside. Maybe something like:
<LinearLayout android:orientation="horizontal" android:layout_height="wrap_content" android:layout_width="wrap_content" android:minHeight="150dp"> <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="wrap_content"> </LinearLayout> <ImageView /> </LinearLayout>
Tricky question because it calls TextView.setMinHeight — but then you are not using a TextView.
So generally android:minHeight
does indeed do something but not in your particular case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With