我有一个MainActivity扩展ActionBarActivity,我想给我的操作栏涂上颜色,我使用的是自定义样式,我使用的自定义样式需要Api 11,至少我尝试使用:
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#0099cc"))); 但是底部的ActionBar没有着色

这是我的Style.xml:
<!--
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="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>
发布于 2014-11-12 13:28:00
如果你想给你的分割动作条着色,你必须使用android:backgroundSplit。下面的代码将对您有帮助。
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#9933CC</item>
<item name="android:backgroundSplit">#9933CC</item>
<item name="android:titleTextStyle">@style/myTheme.ActionBar.Text</item>
</style>
<style name="myTheme.ActionBar.Text" parent="@android:style/TextAppearance">
<item name="android:textColor">#FFFFFF</item>
<item name="android:typeface">monospace</item>
<item name="android:textStyle">bold</item>
</style>https://stackoverflow.com/questions/26887619
复制相似问题