2012-01-06 99 views
0

我設計了一個xml文件,其中包含9個圖像,即每行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

嘗試使用gridview ..... – 2012-01-06 11:37:42

+0

您可以添加截圖嗎? – 2012-01-06 11:53:33

+0

首先嚐試看看你的圖像質量,然後嘗試在你的程序中使用網格視圖,你可以很容易地在gridview中指定寬度和高度 – 2012-01-06 12:13:13

回答

0

設計相似的佈局lanscape模式,並把它們放在「RES /佈局,土地」。確保兩個佈局具有相同的名稱。

+0

感謝它的工作 – NareshRavva 2012-01-09 12:33:36