1

我正在使用ActionBarSherlock,并且想为 ActionBar 和它下面的内容视图使用自定义背景。当我尝试这个时,背景会填满整个屏幕,包括操作栏:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="android:windowBackground">@drawable/background</item>
</style>

因此,从这个答案中,我尝试添加abBackground到主题中:

<style name="MyTheme" parent="@style/Theme.Sherlock">
    <item name="android:windowBackground">@drawable/background</item>
    <item name="abBackground">@drawable/bg_button_idle</item>
</style>

但是,我得到了错误

错误:找不到与给定名称匹配的资源:attr 'abBackground'。

为什么会这样,我该如何解决?

4

3 回答 3

8

以下是更改操作栏背景的方法:

<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>
于 2012-08-03T11:36:30.690 回答
0

//没有abBackground

 <item name="abBackground">@drawable/bg_button_idle</item>

//尝试

<item name="android:background">@drawable/bg_button_idle</item>
于 2012-08-03T11:36:24.257 回答
-2

如果项目是一个库模块,你应该检查库模块在此处输入图像描述

于 2016-01-05T07:51:25.223 回答