Android Style and Theme

1.

樣式(Style)是指爲 View 或窗口指定外觀和格式的屬性集合。

主題(Theme)是指對整個 Activity 或應用而不是對單個 View應用的樣式。 以主題形式應用樣式時,Activity 或應用中的每個視圖都將應用其支持的每個樣式屬性。

簡單的說,一個Activity可以設置一個主題,而該主題中包含多個樣式,如ActionBar的樣式,ActionMode的樣式,以及該Activity中字體顏色/大小等等.

 

2. 主題對應的API

API 1:
android:Theme 默認
android:Theme.Black
android:Theme.Light  背景白色
android:Theme.Wallpaper
android:Theme.Translucent
android:Theme.Panel
android:Theme.Dialog

API 11:
android:Theme.Holo Holo
android:Theme.Holo.Black
android:Theme.Holo.Light

API 14:
Theme.DeviceDefault
Theme.DeviceDefault.Black
Theme.DeviceDefault.Light

API 21:
Theme.Material
Theme.Material.Light

 

3.

API:https://developer.android.com/guide/topics/ui/themes.html

源碼: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values

 

themes_device_defaults.xml : Theme.DeviceDefault.Light ,parent="Theme.Material.Light"

themes_material.xml: Theme.Material.Light parent="Theme.Light",

theme.xml:Theme.Light

 

writing...

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章