michael
michael

Reputation: 110510

How to specify a LinearLayout to either wrap_content if it exceeds certain width

I have want to layout an ImageView and then follow by a LinearLayout (to the right of it).

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <ImageView android:id="@+id/icon" android:layout_width="20px"
        android:layout_height="20px" />
    <RelativeLayout android:id="@+id/side" android:layout_width="fill_parent" android:layout_weight="1" android:layout_width="????"> 
          // some children here
     </RelativeLayout>
 </LinearLayout>

How can I configure my side panel so that it either use 'wrap_content' if the height is > than the image view? if not, use the height of the image i.e. 20px?

Upvotes: 0

Views: 191

Answers (1)

jtb
jtb

Reputation: 889

I think you should be able to use wrap_content then use the android:minHeight(API reference) parameter to make sure that the element is at least 20px.

Upvotes: 1

Related Questions