这组样式格式化了动作栏,包括背景、标题和副标题文本;它还格式化选项卡,包括所有状态(选中、未选中和所有聚焦/按下的组合),以及选项卡文本字体和大小(根据 Android 开发人员说明https://developer.android.com/training/basics /actionbar/styling.html):
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/themeActionBar</item>
<item name="android:actionBarTabTextStyle">@style/styleActionBarTabText</item>
<item name="android:actionMenuTextColor">@color/actionbar_text</item>
<item name="android:actionBarTabStyle">@style/styleActionBarTabs</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/themeActionBar</item>
<item name="actionBarTabTextStyle">@style/styleActionBarTabText</item>
<item name="actionMenuTextColor">@color/actionbar_text</item>
<item name="actionBarTabStyle">@style/styleActionBarTabs</item>
</style>
<!-- ActionBar styles -->
<style name="themeActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">@drawable/abactionbargradient</item>
<item name="android:titleTextStyle">@style/styleActionBarTitleText</item>
<item name="android:subtitleTextStyle">@style/styleActionBarSubTitleText</item>
<!-- Support library compatibility -->
<item name="background">@drawable/abactionbargradient</item>
<item name="titleTextStyle">@style/styleActionBarTitleText</item>
<item name="subtitleTextStyle">@style/styleActionBarSubTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="styleActionBarTitleText"
parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/actionbar_title_text</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
<!-- ActionBar title text -->
<style name="styleActionBarSubTitleText"
parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">@color/actionbar_sub_title_text</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
<!-- ActionBar tabs text -->
<style name="styleActionBarTabText"
parent="@style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">@color/actionbar_text</item>
<item name="android:textSize">10dp</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
<!-- ActionBar tabs styles -->
<style name="styleActionBarTabs"
parent="@style/Widget.AppCompat.ActionBar.TabView">
<!-- tab indicator -->
<item name="android:background">@drawable/abactionbartabs</item>
<!-- Support library compatibility -->
<item name="background">@drawable/abactionbartabs</item>
</style>
当可绘制对象是使用一组连贯颜色值的渐变时,这组样式看起来特别好(例如,选定的淡紫色到紫色,未选定的紫色到淡紫色,将值更改为按下时更暗,聚焦时更亮)。