Android的 - 与支持V7在XML应用selectableItemBackground [英] android - apply selectableItemBackground in xml with support v7

查看:119
本文介绍了Android的 - 与支持V7在XML应用selectableItemBackground的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使有支持Android V7包含在我的应用程序

even with android support v7 included in my application

添加 安卓背景=机器人:ATTR / selectableItemBackground

让我的IDE,Eclipse将抛出一个错误($ P $的编译pventing我),通知我说selectableItemBackground仅用于分钟阿比11以上。

makes my IDE, Eclipse throw an error (preventing me from compiling), notifying me that selectableItemBackground is only for min Api 11 and up.

我如何添加这个属性为背景XML?

How do I add this attribute to a background in XML?

假设复制和粘贴从一个更高的库不是一个解决办法

assume that copying and pasting from a higher library is not a solution

推荐答案

由于属性是在库(支持V7)定义,你可以使用它作为一个用户定义的属性:即没有机器人: preFIX:

Since the attribute is defined in a library (support v7), you would use it as a user-defined attribute: i.e without the android: prefix:

android:background="?attr/selectableItemBackground"

您看到的错误是指出安卓?ATTR / selectableItemBackground 适用于API版本> = 11,真正的,确实

The error you see is pointing out that ?android:attr/selectableItemBackground is available for API versions >= 11. True, indeed.

这篇关于Android的 - 与支持V7在XML应用selectableItemBackground的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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