2012-03-23 94 views
0

我正在做閃屏,哪個背景有圖像。我把480x800大小的圖像放在可繪製的hdpi中,其餘的都是mdpi(320x480),lpdi(240x320)。圖像沒有正確設置在屏幕上?

問題是,當我測試華電國際仿真器或其它仿真圖像不適合

代碼原樣

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
    <ImageView 
    android:src="@drawable/splash" 
    android:id="@+id/imageView1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    </ImageView> 
</LinearLayout> 

套入actvity簡單..

回答

0

你檢查出scaleType屬性?你可以將它設置爲居中或其他東西,看看它現在是否縮放。

0

試試這個代碼

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:background="@drawable/ic_launcher"> 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:src="@drawable/ic_launcher" /> 

    </LinearLayout> 
+0

再次在這個答案中,你的代碼中是否有任何不同? – 2012-03-23 09:53:12

0

使用android:scaleType內ImageView的屬性。

爲了更多地瞭解這個屬性,去這裏=>android:scaleType

1

屏幕分辨率是一回事,但屏幕尺寸是另一回事。 如果你想填補全屏嘗試在XML文件中使用

android:scaleType = "fitXY" 

。但這會延長照片。如果你的圖片不能縮放 請嘗試在android sdk工具文件夾中使用draw9patch

如果不是,請嘗試與其他scaleType方法一起玩。