Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 屏幕上的图像设置不正确?_Android_Xml - Fatal编程技术网

Android 屏幕上的图像设置不正确?

Android 屏幕上的图像设置不正确?,android,xml,Android,Xml,我正在制作背景有图像的启动屏幕。我把480x800大小的图像放在可绘制的hdpi中,类似于mdpi(320x480)、lpdi(240x320)的其余部分 问题是,当我测试hdpi仿真器或其他仿真器映像时,它们并不合适 代码如下- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_heig

我正在制作背景有图像的启动屏幕。我把480x800大小的图像放在可绘制的hdpi中,类似于mdpi(320x480)、lpdi(240x320)的其余部分

问题是,当我测试hdpi仿真器或其他仿真器映像时,它们并不合适

代码如下-

<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>

设置为Activity simply.

是否签出该属性?您可以将其设置为居中或其他位置,然后查看它现在是否可以缩放。

尝试使用此代码

  <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>

在ImageView中使用android:scaleType属性


要了解有关此属性的更多信息,请转到此处=>

屏幕分辨率是一回事,但屏幕尺寸是另一回事。 如果您想填满整个屏幕,请尝试使用

android:scaleType = "fitXY"
在xml文件中。但这会让照片显得有些夸张。如果你的图片缩放不正确 尝试在android sdk工具文件夹中使用draw9patch

如果没有,请尝试使用其他scaleType方法