2012-02-17 69 views
0

我想根據屏幕大小加載佈局。Android - 佈局工作不正常

我的配置

的Android 2.2

小屏幕QVGA(240×320),低密度(120)

圖像分辨率是240×320

RES /佈局-small/myimg.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <ImageView 
     android:src="@drawable/simage" 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
     </ImageView> 
</LinearLayout> 

但是,當我運行應用程序屏幕不完全覆蓋的圖像,屏幕的左側和右側存在一個小的餘量。

我也followind下面的鏈接,但問題仍然存在

http://developer.android.com/guide/practices/screens_support.html#qualifiers

誰能告訴我問題出在哪裏?

回答

1
  1. 可能你的圖像沒有覆蓋所有屏幕。可能圖像有一個透明的邊界或沒有完全正確的大小。你也可以使用一個android:scaleType="fitXY"ImageView
    補充:
  2. 建議你用一個ldpi quilifier而不是small
+0

謝謝。 android:scaleType =「fitXY」解決了這個問題。 – MA1 2012-02-19 20:04:42