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