概述
style 应用于 View,可以在 layout 文件中设置;
theme 本身也是 style,但应用于Activity 或 application,必须在 manifest 文件中设置;
style 的定义
自定义 style 必须放在 res/values 目录下,文件名任意,使用<resource> <style> <item> 标签
自定义 style 的继承写法
自定义 style 的继承可以通过这种写法实现,但不能继承安卓内置的 style
<style <strong>name="CodeFont.Red"</strong>>
<item name="android:textColor">#FF0000</item>
</style>
<style <strong>name="CodeFont.Red.Big"</strong>>
<item name="android:textSize">30sp</item>
</style>
基于系统版本自动选择 theme
通过 “res/values-vXX” 这种方法实现依据不同的系统版本应用不同的 style,并且对XX及以上版本均会生效
参考
这里查看安卓系统 style, theme R.style "/sdk/docs/reference/android/R.style.html"
这里查看 style 的所有属性 R.attr "/sdk/docs/reference/android/R.attr.html"