2012-03-23 93 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方法一起玩。