Android:使用XML显示多个图像

时间:2013-04-02 15:46:12

标签: android android-layout android-image

我有一张分为9个部分的图片,我需要将其显示为一个重建图像。我使用这个XML显示前6个部分,第一行看起来很好,3个图像连续并填充水平空间,但第二行有较小的图像由间隙分隔。我不明白为什么第二行看起来与第一行看起来有很大不同,即使使用相同的XML指令也是如此。

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/game"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >

    <TableRow>       
        <ImageView
            android:id="@+id/zero"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington0" >
        </ImageView>

        <ImageView
            android:id="@+id/one"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington1" >
        </ImageView>

        <ImageView
            android:id="@+id/two"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington2" >
        </ImageView>
    </TableRow>

    <TableRow>
        <ImageView
            android:id="@+id/three"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington3" >
        </ImageView>

        <ImageView
            android:id="@+id/four"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington4" >
        </ImageView>

        <ImageView
            android:id="@+id/five"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/picTile"
            android:src="@drawable/washington5" >
        </ImageView>
    </TableRow>

</TableLayout> 

0 个答案:

没有答案