2

I know the definition of difference between XML attribute starting with @ and ?. The first one refers to global style attribute, while the second one applies to the same attribute within the concrete style. In short.

However, I am still not firm on when to use one or another qualifier. Namely, what is the difference between

android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="@android:style/TextAppearance.Large"

This is the same attribute, right?!

Then, why there is

android:textColor="@android:color/black"

and there is not anything like

android:textColor="?android:color/black" (or similar variance)

Lastly, is the usage of ? the same as using an attribute from DeviceDefault group?

I hope someone will be able to clarify these things for me. I am sure I am over-complicating things and that is why I need clarification.

sandalone
  • 41,141
  • 63
  • 222
  • 338

2 Answers2

0

?android = this is used for access a style attribute that's defined in a style theme

info:http://developer.android.com/guide/topics/resources/accessing-resources.html#ReferencesToThemeAttributes

@android = this is used for resources that are defined in your project or the Android framework.

eg:

android:textAppearance="?android:attr/textAppearanceLarge" this is a style which is in current theme.

android:textAppearance="@android:style/TextAppearance.Large" this is a style which is inbuilt style of android.. no doubt these might be same..

check this link:

dpi value of default "large", "medium" and "small" text views android

Community
  • 1
  • 1
M S Gadag
  • 2,057
  • 1
  • 12
  • 15
  • But "style theme" can be either custom (my) or system (like Holo)? So using `?` on Holo theme would access attributes that only exist in the Holo Theme? – sandalone Jan 19 '15 at 11:51
  • I could not understand your last point. Can you clarify? Maybe on example? I posted a few examples – sandalone Jan 19 '15 at 11:53
0

This is also available

android:textColor="?android:color/black"

Set this to some xml component and you can navigate to that component from xml, which will be inside your

/sdk/platforms/android-#/data/res/values/colors.xml

Jiju Induchoodan
  • 4,236
  • 1
  • 22
  • 24