【发布时间】:2017-10-12 21:31:03
【问题描述】:
我有桌子:
<TableRow
android:layout_weight="1">
<ImageButton
android:background="#111111"
android:layout_height="match_parent"
android:src="@drawable/w"
android:scaleType="fitXY"
/>
<ImageButton
android:background="#111111"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
<ImageButton
android:background="#111111"
android:layout_height="match_parent"
android:scaleType="fitXY"
/>
</TableRow>
<TableRow
android:layout_weight="1">
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
</TableRow>
<TableRow
android:layout_weight="1">
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
<ImageButton
android:background="#111111"
android:layout_height="fill_parent"
/>
</TableRow>
</TableLayout>
最初,一切看起来都不错,但是当我插入图片时,它会立即变形,以适应图像,如屏幕截图所示。告诉我如何解决这个问题? good table 和 bad table
【问题讨论】:
-
这是因为图像的大小不同,您必须使用位图或任何库调整图像大小。我希望这会奏效。
标签: android xml imagebutton tablelayout tablerow