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

Posted by michael on Stack Overflow See other posts from Stack Overflow or by michael
Published on 2010-05-27T02:20:33Z Indexed on 2010/05/27 2:31 UTC
Read the original article Hit count: 253

Filed under:

Hi,

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?

© Stack Overflow or respective owner

Related posts about android