错误:找不到与给定名称匹配的资源:attr'abBackground'
我正在使用ActionBarSherlock
,并且希望为其下方的ActionBar和内容视图使用自定义背景。当我尝试这一点,背景填充整个屏幕,其中包括动作条:错误:找不到与给定名称匹配的资源:attr'abBackground'
<style name="MyTheme" parent="@style/Theme.Sherlock">
<item name="android:windowBackground">@drawable/background</item>
</style>
所以,从this answer,我试图添加abBackground
的主题:
<style name="MyTheme" parent="@style/Theme.Sherlock">
<item name="android:windowBackground">@drawable/background</item>
<item name="abBackground">@drawable/bg_button_idle</item>
</style>
但是,我得到的错误
Error: No resource found that matches the given name: attr 'abBackground'.
这是为什么,我该如何解决?
这里是你如何通过改变动作条背景:
<style name="MyTheme" parent="Theme.Sherlock">
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="Widget.Sherlock.ActionBar">
<item name="background">@drawable/your_custom_drawable</item>
<item name="android:background">@drawable/your_custom_drawable</item>
</style>
//没有abBackground
<item name="abBackground">@drawable/bg_button_idle</item>
//尝试
<item name="android:background">@drawable/bg_button_idle</item>
在整个布局中使用背景f *,所以这不是一个选项。 – nhaarman 2012-08-03 11:42:32
如果您使用贝尼托回答它不。 – Laranjeiro 2013-04-02 15:49:42
您还需要一个操作栏风格的'android:background'项目以及ICS +。 – 2012-08-03 17:12:45