1.在values 文件夹下的styles定义样式
<style name="text_content_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">
<item name="android:textSize">20sp</item>
</style>
注意:
1.样式可以继承: parent
2. 控件自己还可以定义样式,会覆盖 引用的样式
2.在布局文件中引用样式:
<TextView
style="@style/text_content_style"
android:text="你好啊" />
1.定义主题
<style name="red_bg_theme">
<item name="android:background">#33ff0000</item>
</style>
2.在应用程序中引用主题,所有activity会引用:
<application
android:theme="@style/red_bg_theme"
>
3.主题也可以引用在单独的activity中
<activity
android:theme="@style/red_bg_theme"
>
修改android 下的默认主题,可以修改系统默认的样式等
<style name="the">
<item name="android:windowBackground">@drawable/aa</item>
</style>