1,应用的方面:
android中的Styles.xml可以统一格式,比如你有10000个相同TextView,如果有要求你,改其中的文字的大小,你只需要在Styles.xml中改就行了,不需要改10000次,前提是你在TextView中引用了Styles.xml。所以Styles.xml的目的就是以后方便修改。
2,例子:
(1)在Styles.xml文件中:
<resources>
<!--下面的style name自己定义-->
<style name="youName">
<!--item name中写入你要的格式名称,100dp是我们要格式的数据,-->
<item name="android:textSize">100dp</item>
<!--我们可以定义多条-->
<item name="android:textColor">##000fff</item>
</style>
</resources>
(2)在布局文件中的调用:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/youName"/><!--这里调用-->