Android 中 xml文件中的標簽都是表示什么,都是內部定義好的,在哪定義的?
例如
<resources>
???
?????? <declare-styleable name="Topbar">
?????????? <attr name="title" format="string"/>
?????????? <attr name="titleTextSize" format="dimension"/>
?????????? <attr name="titleTextColor" format="color"/>
?????????? <attr name="leftBackground" format="reference|color"/>
?????????? <attr name="leftText" format="string"/>
?????????? <attr name="leftTextColor" format="dimension"/>
?????????? <attr name="rightBackground" format="reference|color"/>
?????????? <attr name="rightText" format="string"/>
?????????? <attr name="rightTextColor" format="dimension"/>
?????? </declare-styleable>
</resources>
這里的<resources>是什么
<declare-styleable>是什么意思,
<attr>呢?
2016-01-22
可以這樣理解,在android里面所有的組件和自定義xml配置文件都是資源,所以有根節點 resources,我們是自定義資源,所有就是declare表示申明為自定義,styleable就是允許有樣式的資源,就行android里的其他組件的樣式一樣,下面的attr就代表每個樣式的名稱=以及類型的定義;通過這種方式android內部就能準確描繪出我們自定義的組件!