What is the difference between: android: attr / textAppearanceMedium and? Android: textAppearanceMedium?

I found that in some demo codes there are two cases: 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> 
+8
source share
3 answers

According to the Android Developer API Guide - Access to Resources - A reference to style attributes , the type of resource is optional if the system resource tool can determine the correct type of resource. Therefore, they refer to the same meaning.

+9
source

I think they both do the same thing that refer to the topic attribute .

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".

[type:] is optional.

More explanation in the following links ...

android layout syntax explanation required

Links to topic attributes

+4
source

There is no single difference between ?android:attr/textAppearanceMedium and ?android:textAppearanceMedium .

You can use each of them as you wish.

0
source

Source: https://habr.com/ru/post/946641/


All Articles