XXHDPI图像在具有相似分辨率的不同设备上看起来不同

时间:2016-01-19 05:10:09

标签: android xml image resolution

我有一个图像,我用它作为相对布局的背景。制作图像时要记住XXHDPI设备的分辨率(1080x1920)。当我在带有 Samsung S4 等物理导航按钮的设备中运行应用程序时,图像看起来非常棒,但是当我在具有屏幕导航按钮的设备中运行应用程序时,相同的图像看起来很模糊,例如 Nexus 5

我附加了输出:

三星S4中的图像很好

enter image description here

图片在Nexus 5中看起来很紧张

enter image description here

使用此图片的布局的源代码

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             tools:context="com.studystory.onboarding.screenOne">


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:background="@drawable/help_screen_one">





    </RelativeLayout>
</FrameLayout>

为什么2个具有相似分辨率的设备的输出不同?为了使两个设备中的图像看起来相似,我需要做些什么?

1 个答案:

答案 0 :(得分:0)

我通过修改布局修复了这个问题。我在布局中使用了一个imageview来显示图像。

示例代码

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.studystory.onboarding.screenFive">

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/imageView"
        android:src="@drawable/help_screen_five"
        android:scaleType="centerCrop"/>
</RelativeLayout>
</FrameLayout>

android:scaleType =“centerCrop”做了这个伎俩。

相关问题