2017-09-06 141 views
0
android:textAppearance="@android:style/TextAppearance.Small" 
android:textAppearance="?android:textAppearanceSmall" 

兩者都給出了相同的結果。編譯效率有沒有差異?這兩種語法有什麼區別?

+0

[(?)問號Android版XML屬性(可能的重複https://stackoverflow.com/questions/2733907/question-mark-in-xml-attributes-for-android ) – alijandro

+0

1st是內置android lib的主題參考,第二個是屬性值 –

回答

1
android:textAppearance="@android:style/TextAppearance.Small" 

是文本樣式設置直接。

android:textAppearance="?android:textAppearanceSmall" 

是在此Activity或此TextView的主題上設置值的引用文本樣式。就像這樣:

<style name="MyStyle"> 
<item name="textAppearanceSmall">@style/textStyle</item> 
</style>