2010-05-27 148 views
0

我想要布局ImageView,然后按LinearLayout(在其右侧)。如何将LinearLayout指定为wrap_content(如果超过一定宽度)

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

我如何配置我的侧面板,使其既可以使用“WRAP_CONTENT”如果高度>比图像有何看法?如果没有,请使用图像的高度,即20px?

回答

1

我认为你应该可以使用wrap_content然后使用android:minHeightAPI reference)参数来确保元素至少为20px。

相关问题