在我的 list 中,应用程序主题指向 styles.xml 文件中列出的 Android 样式:
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="test.theme"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
样式.xml:
<resources>
<style name="AppTheme" parent="android:Theme.Black" />
</resources>
但由于某种原因,主题无法识别,而是加载白色主题。然而,当我将主题直接放入 list 中时,它会按预期运行:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black" >
即使在空的默认项目中也会出现同样的问题。 AppTheme 值列在 R.java 中,因此该文件可以正常识别。有没有人有任何其他想法可能是什么问题?
最佳答案
我最终解决了这个问题,最后这是一个非常简单的问题。
有一个特定于平台的values-v14/styles.xml 文件,我应该将样式放入其中,因为此表中的默认值优先于我对全局values/styles.xml 文件所做的更改.
因此,如果有人最终遇到同样的问题,您可能需要检查是否为目标平台保存了正确的 styles.xml 文件。
关于Android list 无法识别 styles.xml 中列出的系统主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12711168/