Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between ?selectableItemBackground, ?android:selectableItemBackground and ?android:attr/selectableItemBackground in Android?

What is the difference between:

android:background="?selectableItemBackground"

android:background="?attr/selectableItemBackground"

android:background="?android:selectableItemBackground"

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

in Android?

like image 967
francisco_ssb Avatar asked Sep 28 '15 09:09

francisco_ssb


1 Answers

Here,

android:background="?selectableItemBackground"

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"

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

android:background="?android: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.

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

like image 74
subhash Avatar answered Nov 12 '22 18:11

subhash