0
我有以下styles.xml
:Android的动作条的颜色并没有改变
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<item name="android:colorPrimary">@color/primary</item>
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
</style>
</resources>
凡primary
定义为:
<color name="primary">#9c27b0</color>
但是在预览的动作条仍然是黑色的,而不是深紫色。 当我打开主题编辑器时,操作栏也是深紫色。 这是预览版中的错误吗?或者我做错了什么? 一般来说,我如何使用styles.xml
?我还可以在其中定义按钮吗?
你应该使用**工具栏**看到效果。还要确保你的AppTheme在你的AndroidManifest.xml中被设置。 – Amir
http://stackoverflow.com/questions/29957822/changing-background-and-text-color-of-appcompat-light-darkactionbar-theme-on-and –
更好地使用'工具栏'来查看**效果* * colorPrimary *。 –