首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >颜色"splitActionBarWhenNarrow“底部动作条

颜色"splitActionBarWhenNarrow“底部动作条
EN

Stack Overflow用户
提问于 2014-11-12 12:59:19
回答 1查看 820关注 0票数 1

我有一个MainActivity扩展ActionBarActivity,我想给我的操作栏涂上颜色,我使用的是自定义样式,我使用的自定义样式需要Api 11,至少我尝试使用:

代码语言:javascript
复制
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#0099cc"))); 

但是底部的ActionBar没有着色

这是我的Style.xml:

代码语言:javascript
复制
<!--
    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>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-12 13:28:00

如果你想给你的分割动作条着色,你必须使用android:backgroundSplit。下面的代码将对您有帮助。

代码语言:javascript
复制
    <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>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26887619

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档