Reputation:
I find there are two case in some demo codes, What is the difference between ?android:attr/textAppearanceMedium and ?android:textAppearanceMedium ? Thanks!
Case 1
<resources>
<style name="myTextAppearance">
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
Case 2
<resources>
<style name="myTextAppearance">
<item name="android:textAppearance">?android:textAppearanceMedium</item>
</style>
</resources>
Upvotes: 11
Views: 8808
Reputation: 1840
There are no one difference between
?android:attr/textAppearanceMedium
and ?android:textAppearanceMedium
.
You can use each of them, as you wish.
Upvotes: 1
Reputation: 5246
I think they both do the same, that is refer to a theme attribute.
The DOCS say...
Must be a reference to another resource, in the form "@[+][package:]type:name" or to a theme attribute in the form "?[package:][type:]name".
The [type:]
being optional.
More explanation in the following links...
need explanation for android layout syntax
References to Theme Attributes
Upvotes: 5
Reputation: 884
According to Android Developer API Guide - Accessing Resources - Referencing style attributes, the resource type is optional if the system resource tool can figure out the correct resource type. So they are referring to the same value.
Upvotes: 12