嘿我试图改变操作栏的背景但是我不确定我是否理解了样式文件的结构。所以基本上我有style.xml,它将一些元素传递给所需的样式。那么我的Theme.xml里面有一组样式,对吗?如何将两者联系起来,换句话说,如何告诉主题我想要指定的样式呢?我无法改变操作栏的背景,所以这是我的代码:
style.xml:
<!-- Base application theme. -->
<style name="MyActionBar" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:colorBackground">@color/color_lightBlue</item>
</style>
</resources>
theme.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyCustomTheme" parent="Theme.AppCompat.Light">
</style>
</resources>
和wtf是v11 / style?
答案 0 :(得分:3)
无论您将属性放在styles.xml
还是theme.xml
中,如果您将主题应用于您的应用或活动,它们最终会产生相同的效果。在AndroidManifest.xml
中,为了让主题具有您想要的效果,您应该将自定义主题应用到您的应用中。
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >