你好,我是机器人公司的诺布。
我使用appcompat支持库使我的应用程序向后兼容。在这里,动作栏的颜色是Light,默认情况下,我想将背景色更改为我的自定义颜色。
知道怎么做吗??
styles.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

发布于 2014-04-17 13:49:12
这解决了我的问题。谢谢卓哈拉
ActionBar mActionBar = getActionBar();
mActionBar.setBackgroundDrawable(new ColorDrawable("COLOR"));发布于 2014-04-17 13:46:03
您可以尝试使用来自正式文件的方法。我认为它有明确的例子来做这件事。
发布于 2014-04-17 13:52:04
你的风格可能是这样的
参考资料:- https://developer.android.com/training/basics/actionbar/styling.html
<style name="CustomActionBarTheme"
parent="@style/Theme.AppCompat.Light">
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<!-- Support library compatibility -->
<item name="background">@drawable/actionbar_background</item>
</style>https://stackoverflow.com/questions/23134651
复制相似问题