作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 ActionBarSherlock
,并希望为 ActionBar 及其下方的内容 View 使用自定义背景。当我尝试这样做时,背景会填满整个屏幕,包括操作栏:
<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>
关于android - 错误 : No resource found that matches the given name: attr 'abBackground' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11794809/
我是一名优秀的程序员,十分优秀!