Android中的?selectableItemBackground,?android:selectableItemBackground和?android:attr/selectableItemBackground之间的区别? [英] Difference between ?selectableItemBackground, ?android:selectableItemBackground and ?android:attr/selectableItemBackground in Android?

查看:651
本文介绍了Android中的?selectableItemBackground,?android:selectableItemBackground和?android:attr/selectableItemBackground之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两者之间有什么区别

android:background="?selectableItemBackground"

android:background="?attr/selectableItemBackground"

android:background="?android:selectableItemBackground"

android:background="?android:attr/selectableItemBackground" 

在Android中?

推荐答案

在这里,

android:background="?selectableItemBackground"

是来自appCompat库的属性引用,因此它适用于旧版本的android,不需要android前缀.

is attribute reference from appCompat library so it is applied to older versions of android and doesn't need android prefix.

android:background="?android:selectableItemBackground"

是平台提供的属性,该平台可能不支持较旧的android版本,而仅支持其引入的版本.

is attribute provided by platform which may not support older android versions but only from version they are introduced.

android:background="?android:attr/selectableItemBackground"

此处使用attr应用于为当前主题定义的属性.也就是说,如果您为浅色版本设置了应用程序主题,则将应用浅色主题的selectableItemBackground.

Here use of attr applies to the attribute defined for current theme. i.e if you have your application theme set for light version then selectableItemBackground of light theme will be applied.

您可以定义自己的值,而无需使用android前缀即可访问.

And you can define your own values which can be accessed without using android prefix.

这篇关于Android中的?selectableItemBackground,?android:selectableItemBackground和?android:attr/selectableItemBackground之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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