ActionBar 背景修改问题

ActionBar 背景修改 不能用文档里的接口: publicabstract void setBackgroundDrawable (Drawabled),这样设置在程序启动的时候程序并没有加载设置的背景图片,而是加载样式默认的图片或者颜色,程序启动之后背景图片只是对原来的背景进行了覆盖必须在样式表里修改背景,如下:


<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <!-- the theme applied to the application or activity --> 
    <style name="CustomActivityTheme" parent="@android:style/Theme.Holo"> 
        <item name="android:actionBarStyle">@style/MyActionBar</item> 
        <!-- other activity and action bar styles here --> 
    </style> 
<!-- style for the action bar backgrounds --> 
    <style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar"> 
        <item name="android:background">@drawable/ab_background</item> 
        <item name="android:backgroundStacked">@drawable/ab_background</item> 
        <item name="android:backgroundSplit">@drawable/ab_split_background</item> 
    </style> 
</resource>


ActionBar其他特性参源文档:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2012/1114/554.html



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值