Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does minHeight do anything?

Tags:

android

layout

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"    > 

enter image description here

like image 578
Matt Avatar asked Sep 13 '11 20:09

Matt


People also ask

Does height override min height?

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.

What is min height Max content?

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.

How do I get rid of min height?

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".

What is the difference between height and Min height?

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).


2 Answers

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> 
like image 164
kabuko Avatar answered Oct 02 '22 10:10

kabuko


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.

like image 43
Martin Avatar answered Oct 02 '22 10:10

Martin