切换主题功能
使用Activity的切换主题功能实现
1、定义属性
<declare-styleable name="MyThemeAttrs">
<attr name="btn_color" format="color" />
<attr name="btn_background" format="color" />
<attr name="text_color" format="color" />
</declare-styleable>
2、利用上面的属性定义主题
<style name="BlueTheme">
<item name="btn_color">#00f</item>
<item name="btn_background">#0ff</item>
<item name="text_color">#00f</item>
<item name="android:windowBackground">@color/blue_background</item>
</style>
3、在布局文件中设置控件属性值时,引用第1步定义的属性
<TextView
android:layout_width="wrap_content"