错误:未发现的资源与给定名称匹配:ATTR'abBackground“ [英] Error: No resource found that matches the given name: attr 'abBackground'

查看:322
本文介绍了错误:未发现的资源与给定名称匹配:ATTR'abBackground“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 ActionBarSherlock ,并且希望使用自定义背景同时为动作条和它下面的内容视图。当我尝试这一点,背景填充整个屏幕,其中包括动作条:

I'm using ActionBarSherlock, and want to use a custom background for both the ActionBar and the content view below it. When I try this, the background fills the whole screen, including the 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>

不过,我得到的错误

However, I get the error

错误:没有资源发现,给定的名称匹配:ATTRabBackground

Error: No resource found that matches the given name: attr 'abBackground'.

这是为什么,我怎么能解决这个问题?

Why is this, and how can I fix it?

推荐答案

下面是你如何能更改动作条背景:

Here's how you can change the actionbar background:

<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>

这篇关于错误:未发现的资源与给定名称匹配:ATTR'abBackground“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆