背景图像在 nexus 5 中被压缩 android

Background image is compressed in nexus 5 android

我有一张大小等于 Nexus-5 尺寸(1080 x 1920 像素)的初始屏幕图像。 现在,当我在 LinearLayout 的背景中添加此图像时,它似乎被压缩了,这是代码

    <?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:background="@drawable/app_bg"
          android:layout_height="fill_parent">

           <!-- 
              <ImageView android:id="@+id/splash_screen" 
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"
               android:background="@drawable/app_bg"
               android:layout_gravity="center"/>
           -->

     </LinearLayout>

真实图像是

附件是来自 nexus-5 的屏幕截图

要将图像设置为您显示的背景,您应该使用如下图像视图,并使用 android:scaleType="centerCrop" 和框架布局最适合此目的。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ImageView 
    android:id="@+id/background"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop">
</ImageView>  

谢谢