如何在横向视图中解决图像压缩?

时间:2012-01-06 11:24:34

标签: android xml landscape

我设计了一个包含九个图像的xml文件,即每行3行包含3个图像。在纵向视图中,图像显示得非常好,但在横向视图中,前两行图像显示良好,最后一行图像被压缩为小图像。我的xml文件在

下面
<?xml version="1.0" encoding="UTF-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/back" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="16dp"
            android:layout_marginTop="30dp"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/imageView1"
            android:layout_centerHorizontal="true"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/imageView2"
            android:layout_marginRight="24dp"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView1"
            android:layout_below="@+id/imageView1"
            android:layout_marginTop="25dp"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView2"
            android:layout_alignTop="@+id/imageView4"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView3"
            android:layout_alignTop="@+id/imageView5"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView4"
            android:layout_below="@+id/imageView4"
            android:layout_marginTop="25dp"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/imageView5"
            android:layout_alignTop="@+id/imageView7"
            android:src="@drawable/fire_icon" />

        <ImageView
            android:id="@+id/imageView9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignRight="@+id/imageView6"
            android:layout_alignTop="@+id/imageView8"
            android:src="@drawable/fire_icon" />

    </RelativeLayout>
你能告诉我我做错了吗?  提前谢谢

1 个答案:

答案 0 :(得分:0)

在横向模式下设计类似的布局,并将它们放在“res / layout-land”中。确保两个布局都具有相同的名称。