[英]Why global color style for button is not being applied in Theme.MaterialComponents.Light.DarkActionBar in Android?
[英]Android: Theme not being applied and style parent showing up in red
我为片段创建的主题无效。 我收到红色错误消息:“验证Android XML文件中的资源引用”。 我也在清单中分配了正确的主题。 样式文件在这里:
<resources>
<style name="AppTheme" parent="@android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBarTheme</item>
</style>
<style name="MyActionBarTheme" parent="@android:Theme.Holo.Light.ActionBar">
<item name="android:background">#3FF4CB</item>
</style>
</resources>
我的清单在这里:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".LaunchActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".PhysicsFragment"
android:label="@string/title_activity_physics_fragment" >
</activity>
<activity
android:name=".EconFragment"
android:label="@string/title_activity_econ_fragment" >
</activity>
<activity
android:name=".ChemFragment"
android:label="@string/title_activity_chem_fragment" >
</activity>
</application>
<uses-sdk
android:minSdkVersion="8"
android:maxSdkVersion="23">
</uses-sdk>
</manifest>
如果要使用Android的资源,则应使用类似以下的名称空间:
<style name="MyActionBarTheme" parent="@android:style/Theme.Holo.Light.ActionBar">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.