[英]Custom Style of ActionBar is ignored (doesn't work)
我正在嘗試設置ActionBar的樣式。 我在values文件夾中創建了自定義樣式。 找不到錯誤。 我運行了我的應用程序,它運行良好。 但是,我的自定義樣式不起作用,我也不知道為什么。 我所做的所有更改正是我想要的。
我已經在清單android:theme="@style/Theme.AndroidDevelopers"
聲明了Activity主題
當我運行它時,應用程序出現一個難看的操作欄(背景灰色,彈出菜單灰色和文本黑色...默認的藍色方案)-它與我的自定義樣式無關:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AndroidDevelopers" parent="android:style/Theme.Holo.Light">
<item name="android:selectableItemBackground">@drawable/ab_item_background</item>
<item name="android:popupMenuStyle">@style/MyPopupMenu</item>
<item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTabStyle</item>
<item name="android:actionDropDownStyle">@style/MyDropDownNav</item>
<item name="android:listChoiceIndicatorMultiple">@color/amarelo</item>
<item name="android:listChoiceIndicatorSingle">@color/vermelho</item>
</style>
<!-- style the list navigation -->
<style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner">
<item name="android:background">@color/vermelho</item>
<item name="android:popupBackground">@color/orange</item>
<item name="android:dropDownSelector">@drawable/seletor2</item>
</style>
<!-- style for the tabs -->
<style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">@color/verdeclaro</item>
<item name="android:paddingLeft">32dp</item>
<item name="android:paddingRight">32dp</item>
</style>
<!-- style the overflow menu -->
<style name="MyPopupMenu" parent="android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">@color/branco</item>
</style>
<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">@drawable/seletor2</item>
</style>
<style name="MyActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/actionbarbackground</item>
</style>
</resources>`
使用appcompat樣式。
這是一個很好的教程: https : //guides.codepath.com/android/Using-the-App-ToolBar
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.