Android 如何解决横向视图中的图像压缩问题?
我设计了一个包含9个图像的xml文件,即,3行每行包含3个图像。在纵向视图中,图像显示良好,但在横向视图中,前两行图像显示良好,最后一行图像压缩为小图像。下面是我的xml文件Android 如何解决横向视图中的图像压缩问题?,android,xml,landscape,Android,Xml,Landscape,我设计了一个包含9个图像的xml文件,即,3行每行包含3个图像。在纵向视图中,图像显示良好,但在横向视图中,前两行图像显示良好,最后一行图像压缩为小图像。下面是我的xml文件 <?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLa
<?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>
你能告诉我我做错了什么吗。。。
提前感谢在lanscape模式下设计类似的布局,并将它们放在res/layout land中。确保两个布局具有相同的名称。尝试使用gridview…..首先尝试查看图像质量,然后尝试在程序中使用grid view,您可以在gridview中轻松指定宽度和高度