【发布时间】:2016-06-18 15:04:10
【问题描述】:
我正在尝试创建一个包含文本字段(位于屏幕顶部)的布局,在它下方,我需要以 2x2 的表格形式显示图像。我想将所有图像显示为相同大小。
我使用了相对布局和嵌套表格布局,但由于某种原因,我无法将图像视图设置为相同大小。它总是以不同的尺寸显示它们。
...
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/button"
android:layout_below="@+id/TextView">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="???"
android:layout_height="???"
android:layout_weight="1"
</ImageView>
<ImageView
android:id="@+id/imageView2"
android:layout_width="???"
android:layout_height="???"
android:layout_weight="1">
</ImageView>
</TableRow>
<TableRow>
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/imageView3"
android:layout_width="???"
android:layout_height="???"
android:layout_weight="1" >
</ImageView>
<ImageView
android:id="@+id/imageView4"
android:layout_width="???"
android:layout_height="???"
android:layout_weight="1" >
</ImageView>
</TableRow>
谢谢!
【问题讨论】:
标签: android-layout imageview tablelayout