同样的 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>

区别如下:

enter image description here

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top