剖析源碼學自定義主題Theme

http://blog.csdn.net/dawanganban/article/details/17732701


還記得在Android菜鳥的成長筆記(3)中我們曾經遇到了一個問題嗎?"這個界面和真真的QQ界面還有點不同的就是上面的標題myFirstApp,怎麼去掉這個標題呢?",當時我直接在AndroidMainfest.xml中添加了一個屬性:

  1. android:theme="@android:style/Theme.NoTitleBar"   

可能有的朋友就會迷惑了,爲什麼添加了這個屬性就可以了。這一篇文章將讓我們一起翻開Android系統源代碼來揭開困擾大家的關於主題使用以及自定義的謎團。

一、樣式(Style)與主題(Theme)

在Android的應用的資源文件中有一個style.xml文件,這個文件是幹什麼用的呢?我們有時候經常需要對某個類型的組件指定大致相似的格式,比如字體、顏色、背景色等,如果我們每次都爲某個View組件去重複指定這些屬性,這無疑會產生大量的工作,而且還不利於後期的代碼修改和維護。而Style就是一個樣式的格式,這個格式可以被多個View組件所使用,也可以說是一個樣式的集合類,被需要這一類樣式集合的View組件所使用。例如我們前面寫的QQ登錄界面中的登錄按鈕,我們可以給定義一個樣式

  1. <style name="buttonStyle">  
  2.     <item name="android:background">@drawable/login_button_nor</item>  
  3.     <item name="android:textColor">@color/buttonTextColor</item>  
  4. </style>  

在佈局文件中引入樣式

  1. <Button   
  2.     android:layout_width="270dip"  
  3.     android:layout_height="40dip"  
  4.     android:text="@string/login_button"  
  5.     style="@style/buttonStyle"  
  6.     />  
與樣式非常相似,主題資源的xml文件通常也放在/res/values目錄下,主題相當於整個應用或者某個Activity的樣式,換句話說主題是針對窗體級別或整個應用程序的樣式。與樣式比較,樣式是針對窗體內元素的樣式。主題的設置有兩種方式

(1)在AndroidMainfest.xml中爲Activity或者application指定主題

  1. <application  
  2.     android:allowBackup="true"  
  3.     android:icon="@drawable/ic_launcher"  
  4.     android:label="@string/app_name"  
  5.     android:theme="@android:style/Theme.NoTitleBar" >  
  6.     <activity  
  7.         android:name="com.example.myfirstapp.MainActivity"  
  8.         android:label="@string/app_name" >  
  9.         <intent-filter>  
  10.             <action android:name="android.intent.action.MAIN" />  
  11.   
  12.             <category android:name="android.intent.category.LAUNCHER" />  
  13.         </intent-filter>  
  14.     </activity>  
  15. </application>  

上面AndroidMainfest.xml代碼中給整個應用指定了一個主題,這個主題是沒有標題欄的系統主題。

(2)在Activity創建時調用 setTheme方法(必須在setContentView前面調用)來給某個Activity添加主題。

二、剖析主題(Theme)資源

我們先來創建一個工程名字爲helloworld,然後打開它的AndroiodMainfest.xml文件

  1. <application  
  2.     android:allowBackup="true"  
  3.     android:icon="@drawable/ic_launcher"  
  4.     android:label="@string/app_name"  
  5.     android:theme="@style/AppTheme" >  
  6.     <activity  
  7.         android:name="com.example.helloworld.MainActivity"  
  8.         android:label="@string/app_name" >  
  9.         <intent-filter>  
  10.             <action android:name="android.intent.action.MAIN" />  
  11.   
  12.             <category android:name="android.intent.category.LAUNCHER" />  
  13.         </intent-filter>  
  14.     </activity>  
  15. </application>  

可以看到我們在創建工程時,已經默認給我們的整個應用添加了一個主題

  1. android:theme="@style/AppTheme"  
打開我們資源文件res/values/下面的styles.xml文件,可以看到在樣式文件中有一個名字爲AppTheme的樣式,如下:

  1. <resources>  
  2.   
  3.     <!--  
  4.         Base application theme, dependent on API level. This theme is replaced  
  5.         by AppBaseTheme from res/values-vXX/styles.xml on newer devices.  
  6.     -->  
  7.     <style name="AppBaseTheme" parent="android:Theme.Light">  
  8.         <!--  
  9.             Theme customizations available in newer API levels can go in  
  10.             res/values-vXX/styles.xml, while customizations related to  
  11.             backward-compatibility can go here.  
  12.         -->  
  13.     </style>  
  14.   
  15.     <!-- Application theme. -->  
  16.     <style name="AppTheme" parent="AppBaseTheme">  
  17.         <!-- All customizations that are NOT specific to a particular API-level can go here. -->  
  18.     </style>  
  19.   
  20. </resources>  
我們可以看到,這個AppTheme的樣式繼承自上面的AppBaseTheme。而AppBaseTheme又繼承自系統的一個樣式Theme.Light,打開Android系統源代碼找到Theme.xml文件中的Theme.Light如下:

  1.   <!-- Theme for a light background with dark text on top.  Set your activity  
  2.        to this theme if you would like such an appearance.  As with the  
  3.        default theme, you should try to assume little more than that the  
  4.        background will be a light color. -->  
  5.   <style name="Theme.Light">  
  6.       <item name="windowBackground">@drawable/screen_background_light</item>  
  7.       <item name="colorBackground">@android:color/background_light</item>  
  8.       <item name="colorForeground">@color/bright_foreground_light</item>  
  9.       <item name="colorForegroundInverse">@android:color/bright_foreground_light_inverse</item>  
  10.   
  11.       <item name="textColorPrimary">@android:color/primary_text_light</item>  
  12.       <item name="textColorSecondary">@android:color/secondary_text_light</item>  
  13.       <item name="textColorTertiary">@android:color/tertiary_text_light</item>  
  14.       <item name="textColorPrimaryInverse">@android:color/primary_text_dark</item>  
  15.       <item name="textColorSecondaryInverse">@android:color/secondary_text_dark</item>  
  16.       <item name="textColorTertiaryInverse">@android:color/tertiary_text_dark</item>  
  17.       <item name="textColorPrimaryDisableOnly">@android:color/primary_text_light_disable_only</item>  
  18.       <item name="textColorPrimaryInverseDisableOnly">@android:color/primary_text_dark_disable_only</item>  
  19.       <item name="textColorPrimaryNoDisable">@android:color/primary_text_light_nodisable</item>  
  20.       <item name="textColorSecondaryNoDisable">@android:color/secondary_text_light_nodisable</item>  
  21.       <item name="textColorPrimaryInverseNoDisable">@android:color/primary_text_dark_nodisable</item>  
  22.       <item name="textColorSecondaryInverseNoDisable">@android:color/secondary_text_dark_nodisable</item>  
  23.       <item name="textColorHint">@android:color/hint_foreground_light</item>  
  24.       <item name="textColorHintInverse">@android:color/hint_foreground_dark</item>  
  25.         
  26.       <item name="popupWindowStyle">@android:style/Widget.PopupWindow</item>  
  27.         
  28.       <item name="textCheckMark">@android:drawable/indicator_check_mark_light</item>  
  29.       <item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_dark</item>  
  30.   
  31.       <item name="gestureOverlayViewStyle">@android:style/Widget.GestureOverlayView.White</item>  
  32.       <item name="expandableListViewStyle">@android:style/Widget.ExpandableListView.White</item>  
  33.       <item name="listViewStyle">@android:style/Widget.ListView.White</item>  
  34.       <item name="listDivider">@drawable/divider_horizontal_bright</item>  
  35.       <item name="listSeparatorTextViewStyle">@android:style/Widget.TextView.ListSeparator.White</item>  
  36.         
  37.       <item name="progressBarStyle">@android:style/Widget.ProgressBar.Inverse</item>  
  38. <item name="progressBarStyleSmall">@android:style/Widget.ProgressBar.Small.Inverse</item>  
  39. <item name="progressBarStyleLarge">@android:style/Widget.ProgressBar.Large.Inverse</item>  
  40. <item name="progressBarStyleInverse">@android:style/Widget.ProgressBar</item>  
  41. <item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small</item>  
  42. <item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large</item>   
  43.   </style>  
樣式的繼承有兩種方式,一種是上面看到的parent="",還有一種就是用”."的方式,上面的Theme.Light繼承自Theme。這兩種繼承有什麼區別呢?一個相當於咱們類之間的繼承extend,另一個相當於內部類,也可以使用外部類的屬性和方法。我們再來看看Theme.Light的父類Theme的樣式定義。

  1.   <style name="Theme">  
  2.     
  3.       <item name="colorForeground">@android:color/bright_foreground_dark</item>  
  4.       <item name="colorForegroundInverse">@android:color/bright_foreground_dark_inverse</item>  
  5.       <item name="colorBackground">@android:color/background_dark</item>  
  6.       <item name="colorBackgroundCacheHint">?android:attr/colorBackground</item>  
  7.       <item name="disabledAlpha">0.5</item>  
  8.       <item name="backgroundDimAmount">0.6</item>  
  9.   
  10.       <!-- Text styles -->  
  11.       <item name="textAppearance">@android:style/TextAppearance</item>  
  12.       <item name="textAppearanceInverse">@android:style/TextAppearance.Inverse</item>  
  13.   
  14.       <item name="textColorPrimary">@android:color/primary_text_dark</item>  
  15.       <item name="textColorSecondary">@android:color/secondary_text_dark</item>  
  16.       <item name="textColorTertiary">@android:color/tertiary_text_dark</item>  
  17.       <item name="textColorPrimaryInverse">@android:color/primary_text_light</item>  
  18.       <item name="textColorSecondaryInverse">@android:color/secondary_text_light</item>  
  19.       <item name="textColorTertiaryInverse">@android:color/tertiary_text_light</item>  
  20.       <item name="textColorPrimaryDisableOnly">@android:color/primary_text_dark_disable_only</item>  
  21.       <item name="textColorPrimaryInverseDisableOnly">@android:color/primary_text_light_disable_only</item>  
  22.       <item name="textColorPrimaryNoDisable">@android:color/primary_text_dark_nodisable</item>  
  23.       <item name="textColorSecondaryNoDisable">@android:color/secondary_text_dark_nodisable</item>  
  24.       <item name="textColorPrimaryInverseNoDisable">@android:color/primary_text_light_nodisable</item>  
  25.       <item name="textColorSecondaryInverseNoDisable">@android:color/secondary_text_light_nodisable</item>  
  26.       <item name="textColorHint">@android:color/hint_foreground_dark</item>  
  27.       <item name="textColorHintInverse">@android:color/hint_foreground_light</item>  
  28.       <item name="textColorSearchUrl">@android:color/search_url_text</item>  
  29.   
  30.       <item name="textAppearanceLarge">@android:style/TextAppearance.Large</item>  
  31.       <item name="textAppearanceMedium">@android:style/TextAppearance.Medium</item>  
  32.       <item name="textAppearanceSmall">@android:style/TextAppearance.Small</item>  
  33.       <item name="textAppearanceLargeInverse">@android:style/TextAppearance.Large.Inverse</item>  
  34.       <item name="textAppearanceMediumInverse">@android:style/TextAppearance.Medium.Inverse</item>  
  35.       <item name="textAppearanceSmallInverse">@android:style/TextAppearance.Small.Inverse</item>  
  36.       <item name="textAppearanceSearchResultTitle">@android:style/TextAppearance.SearchResult.Title</item>  
  37.       <item name="textAppearanceSearchResultSubtitle">@android:style/TextAppearance.SearchResult.Subtitle</item>  
  38.         
  39.       <item name="textAppearanceButton">@android:style/TextAppearance.Widget.Button</item>  
  40.         
  41.       <item name="candidatesTextStyleSpans">@android:string/candidates_style</item>  
  42.         
  43.       <item name="textCheckMark">@android:drawable/indicator_check_mark_dark</item>  
  44.       <item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_light</item>  
  45.   
  46.       <!-- Button styles -->  
  47.       <item name="buttonStyle">@android:style/Widget.Button</item>  
  48.   
  49.       <item name="buttonStyleSmall">@android:style/Widget.Button.Small</item>  
  50.       <item name="buttonStyleInset">@android:style/Widget.Button.Inset</item>  
  51.   
  52.       <item name="buttonStyleToggle">@android:style/Widget.Button.Toggle</item>  
  53.   
  54.       <!-- List attributes -->  
  55.       <item name="listPreferredItemHeight">64dip</item>  
  56.       <!-- @hide -->  
  57.       <item name="searchResultListItemHeight">58dip</item>  
  58.       <item name="listDivider">@drawable/divider_horizontal_dark</item>  
  59.       <item name="listSeparatorTextViewStyle">@android:style/Widget.TextView.ListSeparator</item>     
  60.         
  61. <item name="listChoiceIndicatorSingle">@android:drawable/btn_radio</item>  
  62.     <item name="listChoiceIndicatorMultiple">@android:drawable/btn_check</item>      
  63.   
  64.       <item name="expandableListPreferredItemPaddingLeft">40dip</item>  
  65.       <item name="expandableListPreferredChildPaddingLeft">  
  66.               ?android:attr/expandableListPreferredItemPaddingLeft</item>  
  67.   
  68.       <item name="expandableListPreferredItemIndicatorLeft">3dip</item>  
  69.       <item name="expandableListPreferredItemIndicatorRight">33dip</item>  
  70.       <item name="expandableListPreferredChildIndicatorLeft">  
  71.               ?android:attr/expandableListPreferredItemIndicatorLeft</item>  
  72.       <item name="expandableListPreferredChildIndicatorRight">  
  73.               ?android:attr/expandableListPreferredItemIndicatorRight</item>  
  74.   
  75.       <!-- Gallery attributes -->  
  76.       <item name="galleryItemBackground">@android:drawable/gallery_item_background</item>  
  77.         
  78.       <!-- Window attributes -->  
  79.       <item name="windowBackground">@android:drawable/screen_background_dark</item>  
  80.       <item name="windowFrame">@null</item>  
  81.       <item name="windowNoTitle">false</item>  
  82.       <item name="windowFullscreen">false</item>  
  83.       <item name="windowIsFloating">false</item>  
  84.       <item name="windowContentOverlay">@android:drawable/title_bar_shadow</item>  
  85.       <item name="windowShowWallpaper">false</item>  
  86.       <item name="windowTitleStyle">@android:style/WindowTitle</item>  
  87.       <item name="windowTitleSize">25dip</item>  
  88.       <item name="windowTitleBackgroundStyle">@android:style/WindowTitleBackground</item>  
  89.       <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>  
  90.       <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>  
  91.   
  92.       <!-- Dialog attributes -->  
  93.       <item name="alertDialogStyle">@android:style/AlertDialog</item>  
  94.         
  95.       <!-- Panel attributes -->  
  96.       <item name="panelBackground">@android:drawable/menu_background</item>  
  97.       <item name="panelFullBackground">@android:drawable/menu_background_fill_parent_width</item>  
  98.       <!-- These three attributes do not seems to be used by the framework. Declared public though -->  
  99.       <item name="panelColorBackground">#000</item>  
  100.       <item name="panelColorForeground">?android:attr/textColorPrimary</item>  
  101.       <item name="panelTextAppearance">?android:attr/textAppearance</item>  
  102.   
  103.       <!-- Scrollbar attributes -->  
  104.       <item name="scrollbarFadeDuration">250</item>  
  105.       <item name="scrollbarDefaultDelayBeforeFade">300</item>   
  106.       <item name="scrollbarSize">10dip</item>  
  107.       <item name="scrollbarThumbHorizontal">@android:drawable/scrollbar_handle_horizontal</item>  
  108.       <item name="scrollbarThumbVertical">@android:drawable/scrollbar_handle_vertical</item>  
  109.       <item name="scrollbarTrackHorizontal">@null</item>  
  110.       <item name="scrollbarTrackVertical">@null</item>  
  111.   
  112.       <!-- Text selection handle attributes -->  
  113.       <item name="textSelectHandleLeft">@android:drawable/text_select_handle_left</item>  
  114.       <item name="textSelectHandleRight">@android:drawable/text_select_handle_right</item>  
  115.       <item name="textSelectHandle">@android:drawable/text_select_handle_middle</item>  
  116.       <item name="textSelectHandleWindowStyle">@android:style/Widget.TextSelectHandle</item>  
  117.   
  118.       <!-- Widget styles -->  
  119.       <item name="absListViewStyle">@android:style/Widget.AbsListView</item>  
  120.       <item name="autoCompleteTextViewStyle">@android:style/Widget.AutoCompleteTextView</item>          
  121.       <item name="checkboxStyle">@android:style/Widget.CompoundButton.CheckBox</item>  
  122.       <item name="dropDownListViewStyle">@android:style/Widget.ListView.DropDown</item>  
  123.       <item name="editTextStyle">@android:style/Widget.EditText</item>  
  124.       <item name="expandableListViewStyle">@android:style/Widget.ExpandableListView</item>  
  125.       <item name="expandableListViewWhiteStyle">@android:style/Widget.ExpandableListView.White</item>  
  126.       <item name="galleryStyle">@android:style/Widget.Gallery</item>  
  127.       <item name="gestureOverlayViewStyle">@android:style/Widget.GestureOverlayView</item>  
  128.       <item name="gridViewStyle">@android:style/Widget.GridView</item>  
  129.       <item name="imageButtonStyle">@android:style/Widget.ImageButton</item>  
  130.       <item name="imageWellStyle">@android:style/Widget.ImageWell</item>  
  131.       <item name="listViewStyle">@android:style/Widget.ListView</item>  
  132.       <item name="listViewWhiteStyle">@android:style/Widget.ListView.White</item>  
  133.       <item name="popupWindowStyle">@android:style/Widget.PopupWindow</item>  
  134.       <item name="progressBarStyle">@android:style/Widget.ProgressBar</item>  
  135.       <item name="progressBarStyleHorizontal">@android:style/Widget.ProgressBar.Horizontal</item>  
  136.       <item name="progressBarStyleSmall">@android:style/Widget.ProgressBar.Small</item>  
  137.       <item name="progressBarStyleSmallTitle">@android:style/Widget.ProgressBar.Small.Title</item>  
  138.       <item name="progressBarStyleLarge">@android:style/Widget.ProgressBar.Large</item>  
  139.       <item name="progressBarStyleInverse">@android:style/Widget.ProgressBar.Inverse</item>  
  140. <item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small.Inverse</item>  
  141.    <item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large.Inverse</item>   
  142.       <item name="seekBarStyle">@android:style/Widget.SeekBar</item>  
  143.       <item name="ratingBarStyle">@android:style/Widget.RatingBar</item>  
  144.       <item name="ratingBarStyleIndicator">@android:style/Widget.RatingBar.Indicator</item>  
  145.       <item name="ratingBarStyleSmall">@android:style/Widget.RatingBar.Small</item>  
  146.       <item name="radioButtonStyle">@android:style/Widget.CompoundButton.RadioButton</item>  
  147.       <item name="scrollViewStyle">@android:style/Widget.ScrollView</item>  
  148.       <item name="horizontalScrollViewStyle">@android:style/Widget.HorizontalScrollView</item>  
  149.       <item name="spinnerStyle">@android:style/Widget.Spinner</item>  
  150.       <item name="starStyle">@android:style/Widget.CompoundButton.Star</item>  
  151.       <item name="tabWidgetStyle">@android:style/Widget.TabWidget</item>  
  152.       <item name="textViewStyle">@android:style/Widget.TextView</item>  
  153.       <item name="webTextViewStyle">@android:style/Widget.WebTextView</item>  
  154.       <item name="webViewStyle">@android:style/Widget.WebView</item>  
  155.       <item name="dropDownItemStyle">@android:style/Widget.DropDownItem</item>  
  156.       <item name="spinnerDropDownItemStyle">@android:style/Widget.DropDownItem.Spinner</item>  
  157.       <item name="spinnerItemStyle">@android:style/Widget.TextView.SpinnerItem</item>  
  158.       <item name="dropDownHintAppearance">@android:style/TextAppearance.Widget.DropDownHint</item>  
  159.       <item name="keyboardViewStyle">@android:style/Widget.KeyboardView</item>  
  160.       <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.QuickContactBadge.WindowSmall</item>  
  161.       <item name="quickContactBadgeStyleWindowMedium">@android:style/Widget.QuickContactBadge.WindowMedium</item>  
  162.       <item name="quickContactBadgeStyleWindowLarge">@android:style/Widget.QuickContactBadge.WindowLarge</item>  
  163.       <item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.QuickContactBadgeSmall.WindowSmall</item>  
  164.       <item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.QuickContactBadgeSmall.WindowMedium</item>  
  165.       <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item>  
  166.         
  167.       <!-- Preference styles -->  
  168.       <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>  
  169.       <item name="preferenceCategoryStyle">@android:style/Preference.Category</item>  
  170.       <item name="preferenceStyle">@android:style/Preference</item>  
  171.       <item name="preferenceInformationStyle">@android:style/Preference.Information</item>  
  172.       <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item>  
  173.       <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item>  
  174.       <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item>  
  175.       <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>  
  176.       <item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>  
  177.       <item name="preferenceLayoutChild">@android:layout/preference_child</item>  
  178.   
  179.       <!-- Search widget styles -->  
  180.       <item name="searchWidgetCorpusItemBackground">@android:color/search_widget_corpus_item_background</item>  
  181.   </style>  
  182.     

我們可以看到裏面定義了關於我們整個應用中文字的樣式,按鈕的樣式,列表的樣式,畫廊的樣式,窗體的樣式,對話框的樣式等。這個樣式是系統的默認樣式,也是最符合HOLO的樣式。Theme中定義的是最基本的主題樣式,Theme的樣式擴展樣式有我們上面的Theme.Light還有Theme.NoTitleBar、Theme.NoTitleBar.Fullscreen、Theme.Light.NoTitleBar、Theme.Light.NoTitleBar.Fullscreen、Theme.Black、......

三、自定義主題

有了上面對Theme的瞭解之後,下面我們通過改變標題欄來自定義主題樣式,首先繼承Theme,標題欄是與窗體樣式(Window attributes)相關的樣式,我們在Theme.xml中找到這幾句代碼.

  1. <!-- Window attributes -->  
  2.        <item name="windowBackground">@android:drawable/screen_background_dark</item>  
  3.        <item name="windowFrame">@null</item>  
  4.        <item name="windowNoTitle">false</item>  
  5.        <item name="windowFullscreen">false</item>  
  6.        <item name="windowIsFloating">false</item>  
  7.        <item name="windowContentOverlay">@android:drawable/title_bar_shadow</item>  
  8.        <item name="windowShowWallpaper">false</item>  
  9.        <item name="windowTitleStyle">@android:style/WindowTitle</item>  
  10.        <item name="windowTitleSize">25dip</item>  
  11.        <item name="windowTitleBackgroundStyle">@android:style/WindowTitleBackground</item>  
  12.        <item name="android:windowAnimationStyle">@android:style/Animation.Activity</item>  
  13.        <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item>  

將上面主題中Title的大小和背景覆蓋

  1. <!-- 自定義的主題樣式 -->  
  2. <style name="myTheme" parent="android:Theme">  
  3.     <item name="android:windowTitleBackgroundStyle">@style/myThemeStyle</item>  
  4.     <item name="android:windowTitleSize">50dip</item>  
  5. </style>  
  6.   
  7. <!-- 主題中Title的背景樣式 -->  
  8. <style name="myThemeStyle">  
  9.     <item name="android:background">#FF0000</item>  
  10. </style>  

默認主題樣式

自定義主題樣式



如果有的朋友還想改變整個應用的字體、或者風格都可以通過繼承Theme覆蓋原有的樣式來達到自定義的效果。

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