Difference from? attr: with? android: attr / on Android

3

What is the difference between specifying values in the attributes using ?attr: or using ?android:attr/

For example to apply the color of the text as if it were a deactivated control (soft gray)

Directly:

android:textColor="@android:color/secondary_text_dark" /> 

using? android: attr /:

android:textColor="?android:attr/textColorSecondaryNoDisable" /> 

Values extracted from themes.xml

    
asked by Webserveis 02.11.2016 в 17:40
source

2 answers

1

The difference is where you get the values, in this case the attributes, in the case of using:

?android:attr

the attributes are obtained from the SDK

In the case of using:

?attr 

The attributes are obtained by definition made in your application, for example in the file attrs.xml .

This is similar to obtaining other properties such as color, for example, in this case we obtain a color defined in our file colors.xml :

android:background="@color/black"

But we can get the color defined in the SDK by means of @android:

android:background="@android:color/black"
    
answered by 02.11.2016 / 19:33
source
1

The difference is that ?attr are references to values that you have created while ?android:attr are ready values, incorporated and available on Android.

    
answered by 02.11.2016 в 17:47