调整布局中的视图大小

时间:2010-11-15 16:03:47

标签: android

我有一个带有多个图像视图的水平线性布局。有没有办法自动调整这些视图的大小,以便所有这些视图都适合屏幕? 这是代码:

<LinearLayout
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView 
    android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/cinnamon"/>
<ImageView 
    android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/cinnamon"/>
<ImageView 
    android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ham"/>

最好的问候

1 个答案:

答案 0 :(得分:0)

使用所有图像视图,确保将布局设置为最符合您需求的布局。试试“fill_parent”。宽度和高度。向我们提供一些代码以及您希望向用户显示的布局的更好描述,我们可以为您提供更好的示例。如果这有帮助,请告诉我们。

<强>解决方案

为每个图像视图将layout_weight设置为1.