Android Theme详细




1.系统主题Theme列表


Android Theme详细_第1张图片


2.详解每个主题中定义item分类


一个完整的主题应该定义哪些内容呢,以Theme为例,如下:


颜色

@android:color/bright_foreground_dark

@android:color/bright_foreground_dark_inverse

@android:color/background_dark

?android:attr/colorBackground

@color/legacy_pressed_highlight

@color/legacy_long_pressed_highlight

@color/legacy_selected_highlight

@color/legacy_selected_highlight

@color/legacy_selected_highlight


字体



@android:style/TextAppearance

@android:style/TextAppearance.Inverse

 

@android:color/primary_text_dark

@android:color/secondary_text_dark

@android:color/tertiary_text_dark

@android:color/primary_text_light

@android:color/secondary_text_light

@android:color/tertiary_text_light

@android:color/primary_text_dark_disable_only

@android:color/primary_text_light_disable_only

@android:color/primary_text_dark_nodisable

@android:color/secondary_text_dark_nodisable

@android:color/primary_text_light_nodisable

@android:color/secondary_text_light_nodisable

@android:color/hint_foreground_dark

@android:color/hint_foreground_light

@android:color/search_url_text

@android:color/highlighted_text_dark

@android:color/highlighted_text_light

@android:color/link_text_dark

@android:color/link_text_light

@android:color/primary_text_light_disable_only

 

@android:style/TextAppearance.Large

@android:style/TextAppearance.Medium

@android:style/TextAppearance.Small

@android:style/TextAppearance.Large.Inverse

@android:style/TextAppearance.Medium.Inverse

@android:style/TextAppearance.Small.Inverse

@android:style/TextAppearance.SearchResult.Title

@android:style/TextAppearance.SearchResult.Subtitle

 

@android:style/TextAppearance.EasyCorrectSuggestion

@android:style/TextAppearance.MisspelledSuggestion

@android:style/TextAppearance.AutoCorrectionSuggestion

 

@android:style/TextAppearance.Widget.Button

 

@android:color/primary_text_light

@android:drawable/edit_text

 

@android:string/candidates_style

 

@android:drawable/indicator_check_mark_dark

@android:drawable/indicator_check_mark_light

 

@android:style/TextAppearance.Widget.PopupMenu.Large

@android:style/TextAppearance.Widget.PopupMenu.Small


按钮



@android:style/Widget.Button

 

@android:style/Widget.Button.Small

@android:style/Widget.Button.Inset

 

@android:style/Widget.Button.Toggle

 

@android:drawable/item_background

?android:attr/buttonStyle

@android:drawable/ic_ab_back_holo_dark


list



64dip

?android:attr/listPreferredItemHeight

?android:attr/listPreferredItemHeight

?android:attr/listPreferredItemHeight

?android:attr/textAppearanceLarge

?android:attr/textAppearanceLarge

6dip

6dip

6dip

6dip


window



@android:drawable/screen_background_selector_dark

@null

false

false

false

false

@null

false

@android:style/WindowTitle

25dip

@android:style/WindowTitleBackground

@android:style/Animation.Activity

stateUnspecified|adjustUnspecified

false

false

false

false

false


Dialog



@android:style/Theme.Dialog

@layout/dialog_title_icons

@layout/dialog_custom_title

@layout/dialog_title


AlertDialog




@android:style/Theme.Dialog.Alert

@android:style/AlertDialog

true

@android:drawable/ic_dialog_alert 


Panel




@android:drawable/menu_background

@android:drawable/menu_background_fill_parent_width



#000

?android:attr/textColorPrimary

?android:attr/textAppearance

 

false

296dip 


滚动条



250

300 

10dip

@android:drawable/scrollbar_handle_horizontal

@android:drawable/scrollbar_handle_vertical

@null

@null


文字选中(Text Selection)



@android:drawable/text_select_handle_left

@android:drawable/text_select_handle_right

@android:drawable/text_select_handle_middle

@android:style/Widget.TextSelectHandle

@android:layout/text_edit_paste_window

@android:layout/text_edit_no_paste_window

@android:layout/text_edit_side_paste_window

@android:layout/text_edit_side_no_paste_window

@android:style/Widget.TextSuggestionsPopupWindow

@android:layout/text_edit_suggestion_item

@null


Widget样式


        @android:style/Widget.AbsListView
        @android:style/Widget.AutoCompleteTextView        
        @android:style/Widget.CompoundButton.CheckBox
        @android:style/Widget.CheckedTextView
        @android:style/Widget.ListView.DropDown
        @android:style/Widget.EditText
        @android:style/Widget.ExpandableListView
        @android:style/Widget.ExpandableListView.White
        @android:style/Widget.Gallery
        @android:style/Widget.GestureOverlayView
        @android:style/Widget.GridView
        @android:style/Widget.ImageButton
        @android:style/Widget.ImageWell
        @android:style/Widget.ListView
        @android:style/Widget.ListView.White
        @android:style/Widget.PopupWindow
        @android:style/Widget.ProgressBar
        @android:style/Widget.ProgressBar.Horizontal
        @android:style/Widget.ProgressBar.Small
        @android:style/Widget.ProgressBar.Small.Title
        @android:style/Widget.ProgressBar.Large
        @android:style/Widget.ProgressBar.Inverse
        @android:style/Widget.ProgressBar.Small.Inverse
        @android:style/Widget.ProgressBar.Large.Inverse
        @android:style/Widget.SeekBar
        @android:style/Widget.RatingBar
        @android:style/Widget.RatingBar.Indicator
        @android:style/Widget.RatingBar.Small
        @android:style/Widget.CompoundButton.RadioButton
        @android:style/Widget.ScrollView
        @android:style/Widget.HorizontalScrollView
        @android:style/Widget.Spinner
        @android:style/Widget.Spinner.DropDown
        @android:style/Widget.CompoundButton.Star
        @android:style/Widget.TabWidget
        @android:style/Widget.TextView
        @android:drawable/popup_inline_error
        @android:drawable/popup_inline_error_above
        @android:style/Widget.WebTextView
        @android:style/Widget.WebView
        @android:style/Widget.DropDownItem
        @android:style/Widget.DropDownItem.Spinner
        @android:style/Widget.TextView.SpinnerItem
        @android:style/TextAppearance.Widget.DropDownHint
        @android:style/Widget.KeyboardView
        @android:drawable/quickcontact_badge_overlay_dark
        @android:style/Widget.QuickContactBadge.WindowSmall
        @android:style/Widget.QuickContactBadge.WindowMedium
        @android:style/Widget.QuickContactBadge.WindowLarge
        @android:style/Widget.QuickContactBadgeSmall.WindowSmall
        @android:style/Widget.QuickContactBadgeSmall.WindowMedium
        @android:style/Widget.QuickContactBadgeSmall.WindowLarge
        @android:style/Widget.ListPopupWindow
        @android:style/Widget.PopupMenu
        @android:style/Widget.ActivityChooserView

        @android:style/Widget.DeviceDefault.MediaRouteButton


Preference样式(Preference Style)

  
        @android:style/Preference.PreferenceScreen
        @style/PreferenceFragment
        @android:style/Preference.Category
        @android:style/Preference
        @android:style/Preference.Information
        @android:style/Preference.CheckBoxPreference
        @android:style/Preference.SwitchPreference
        @android:style/Preference.DialogPreference.YesNoPreference
        @android:style/Preference.DialogPreference
        @android:style/Preference.DialogPreference.EditTextPreference
        @android:style/Preference.RingtonePreference
        @android:layout/preference_child
        @style/PreferencePanel
        @style/PreferenceHeaderPanel
        @style/PreferenceHeaderList
        @style/PreferenceFragmentList
        @dimen/preference_fragment_padding_side
        @android:drawable/panel_bg_holo_dark


search控件样式


@android:color/search_widget_corpus_item_background

@android:drawable/spinner_dropdown_background
@drawable/textfield_searchview_holo_dark@drawable/textfield_searchview_right_holo_dark
@android:drawable/ic_clear
@android:drawable/ic_search
@android:drawable/ic_go
@android:drawable/ic_voice_search
@android:drawable/ic_commit_search_api_holo_dark
?attr/selectableItemBackground

@style/Theme.SearchBar


ActionBar样式( Action bar Style)

        
        @android:style/Widget.Spinner.DropDown
        @android:style/Widget.ActionButton
        @android:style/Widget.ActionButton.Overflow
        @android:drawable/cab_background_top_holo_dark
        @null
        @android:drawable/ic_menu_close_clear_cancel
        @android:drawable/ic_menu_cut_holo_dark
        @android:drawable/ic_menu_copy_holo_dark
        @android:drawable/ic_menu_paste_holo_dark
        @android:drawable/ic_menu_selectall_holo_dark
        @android:drawable/ic_menu_share_holo_dark
        @android:drawable/ic_menu_find_holo_dark
        @android:drawable/ic_menu_search
        @style/Widget.ActionBar.TabView
        @style/Widget.ActionBar.TabBar
        @style/Widget.ActionBar.TabText
        @style/Widget.ActionMode
        @style/Widget.ActionButton.CloseMode
        @android:style/Widget.ActionBar
        ?android:attr/actionBarStyle
        @dimen/action_bar_default_height
        ?android:attr/popupWindowStyle
        @android:style/TextAppearance.Holo.Widget.ActionBar.Menu
        ?android:attr/textColorPrimary
        @null
        ?android:attr/dividerVertical
        ?android:attr/selectableItemBackground

        @drawable/divider_vertical_dark
        @drawable/divider_vertical_dark
        @android:style/ButtonBar
        ?android:attr/buttonStyle
        @android:style/SegmentedButton


其他样式

        
        @android:style/Widget.PreferenceFrameLayout

        
        @style/Widget.NumberPicker

        
        @style/Widget.CalendarView

        
        @style/Widget.TimePicker

        
        @style/Widget.DatePicker

        @android:drawable/scrollbar_handle_accelerated_anim2
        @null
        @android:drawable/menu_submenu_background
        @android:drawable/menu_submenu_background
        floating
        @android:color/primary_text_dark

        
        @android:style/Pointer

        
        @android:drawable/view_accessibility_focused

3、一些细化的style(特别是大量的控件的样式)定义在了styles.xml

themes.xml偏全局,styles.xml偏细化。
我直接贴出链接地址,大家查看:
https://github.com/CyanogenMod/android_frameworks_base/blob/cm-11.0/core/res/res/values/styles.xml

4、我们能做什么

两点说明:

  • 我们可以根据这些样式改变系统控件的样式
  • 但不是所有的样式我们都可以修改,比如AlertDialog,布局和一些属性都是写在硬编码中了,我们是无法修改的。

通过学习这些主题和样式,我们能准确的把握我们能定制哪些样式,哪些我们不能定制,是否需要重新写一套替代的UI控件。

这个在项目决策和进度评估上是非常重要的。





你可能感兴趣的:(Android,Framework,Android,Apk)