Kitkat没有从布局XML文件中获取android:background,Jelly还可以

Kitkat没有从布局XML文件中获取android:background,Jelly还可以,android,android-manifest,android-background,Android,Android Manifest,Android Background,相同的XML在Android 4.3和4.4中看起来不同。问题是Kitkat(4.4)没有选择这一行:“android:background=“@drawable/darkgray”(darkgray.jpg是一个img) 为什么Kitkat的行为有所不同 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android

相同的XML在Android 4.3和4.4中看起来不同。问题是Kitkat(4.4)没有选择这一行:
“android:background=“@drawable/darkgray”
(darkgray.jpg是一个img)

为什么Kitkat的行为有所不同

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.mavdev.focusoutfacebook"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/darkgray"

android:orientation="vertical" >

<TextView
    android:id="@+id/tv_secs2"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    />

</RelativeLayout>

区别如下:


这可能是因为您的4.4手机有不同的DPI。请再次确认。

有DPI问题吗?您把darkgray放在哪里了?谢谢-您的提示起作用了。我只把darkgray放在了drawable文件夹中。我把它添加到了所有的文件夹中:drawable hdpi、drawable ldpi、drawable mdpi、drawable xhdpi和drawable xxhdpi-它起作用了!可能是这样的因为我试的两部手机的屏幕分辨率不同?如果你能把这个作为答案发布-我会接受。已经完成了,谢谢。