Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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_Image_Background - Fatal编程技术网

Android 线性布局背景图像在少数设备上不可见

Android 线性布局背景图像在少数设备上不可见,android,image,background,Android,Image,Background,我使用线性布局为屏幕设置背景图像,它在emulator、samsung J7和samsung duos上可见,但在galaxy S5上不可见。为什么会出现这种差异?如何添加到图像作为线性布局的背景资源。这是我已经完成的xml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:o

我使用线性布局为屏幕设置背景图像,它在emulator、samsung J7和samsung duos上可见,但在galaxy S5上不可见。为什么会出现这种差异?如何添加到图像作为线性布局的背景资源。这是我已经完成的xml文件

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg">

</LinearLayout>

为了解决这个问题:

您可以通过为背景提供颜色来检查代码的执行情况,因为图像可能存在分辨率问题,并且可能无法显示


因此,为了解决此分辨率问题,您应该在hdpi、xhdpi、mdpi文件夹中提供不同大小的图像。

您可以发布活动的屏幕截图吗?显示白色空(白色)屏幕检查下面的答案,如果可行,请回复我。尝试在hdpi、xhdpi、mdpi文件夹中放置不同大小的图像。使用android studio asset ManagerRok,我会试试这个