【发布时间】:2011-07-07 19:01:42
【问题描述】:
我正在使用表格布局来放置 ImageView,我正在连续添加 5 个 imageView,现在我希望根据屏幕宽度所有 ImageViews 自动调整它们之间的距离,我该怎么做,我的 TableLayout 如下所示。 .
<TableLayout android:id="@+id/tableLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/transparent_background">
<TableRow android:id="@+id/tableRow1" android:layout_height="wrap_content" android:stretchColumns="*" android:layout_width="fill_parent">
<ImageView android:layout_height="wrap_content" android:id="@+id/imageView1" android:layout_width="wrap_content" android:src="@drawable/tea"></ImageView>
<ImageView android:layout_height="wrap_content" android:id="@+id/imageView2" android:layout_width="wrap_content" android:src="@drawable/bye" ></ImageView>
<ImageView android:layout_height="wrap_content" android:id="@+id/imageView3" android:layout_width="wrap_content" android:src="@drawable/brb" ></ImageView>
<ImageView android:layout_height="wrap_content" android:id="@+id/imageView4" android:layout_width="wrap_content" android:src="@drawable/pizza" ></ImageView>
<ImageView android:layout_height="wrap_content" android:id="@+id/imageView5" android:layout_width="wrap_content" android:src="@drawable/beer"></ImageView>
</TableRow>
<TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content"></TableRow>
<TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content"></TableRow>
<TableRow android:id="@+id/tableRow4" android:layout_width="wrap_content" android:layout_height="wrap_content"></TableRow>
</TableLayout>
【问题讨论】:
标签: android uiimageview