First introduce the background, using the support V7 21+ Compatibility Library to implement material style
Theme
<style name= "Basetheme" parent= "Theme.AppCompat.Light.NoActionBar" > <!--Customize your Theme here. --<item name= "Windowactionbar" >false</item> <item name= "Android:windownotitle" >TRUE&L t;/item> <!--Actionbar Color--<item name= "Colorprimary" > @color/android_blue</item> <!--Status Bar color--> <item name= "Colorprimarydark" > @color/android_blue</item> &L T;item name= "Android:windowcontentoverlay" > @null </item> <item name= "android:scrollbarthumbvertical" & GT, @drawable/scrollbar_handle_holo_light</item> <item name= "Android:windowanimationstyle" > @style/ activityanimationstyle</item> <item name= "Android:textcolor" > @color/black</item> <item Name= "Coloraccent" > @color/android_blue</item> <item name= "android:textcolorprimary" > @color/black& Lt;/item> </style>
But the effect that comes up is
Three black dots and backgrounds and the text in front of the language is out of tune, so how to solve this problem, Nikki? Search for some solutions like
<style name="Mycustomtheme" Parent="Theme.AppCompat.Light.NoActionBar"> <Item Name="Android:actionoverflowbuttonstyle">@style/Mycustomtheme.OverFlow</Item> <Item Name="Actionoverflowbuttonstyle">@style/Mycustomtheme.OverFlow</Item></style><style name="Mycustomtheme.overflow"> <Item Name="ANDROID:SRC">@drawable/My_overflow_image</Item></style>
But no effect, suddenly think of an open source project Sky31radio, have encountered the same scene, sure enough to find a solution, the crux of the problem is to use the toolbar to replace the Actionbar, then the menu and overflow style should be defined on the toolbar.
Here's the solution:
Actionbar in the upper right corner if you want to customize the style of the text menu, you need to customize it in toolbar
App:theme= "@style/apptheme.actionbar"
And then in the Style.xml,
<style name= "Apptheme.actionbar" parent= "<span style=" color: #ff0000; " > @style/themeoverlay.appcompat.dark.actionbar</span> "> <item name=" Actionmenutextcolor "># fff</item> <item name= "actionmenutextappearance" > @style/apptheme.actionmenutextsize</item > </style> <style name= "apptheme.actionmenutextsize" parent= " Base.TextAppearance.AppCompat.Widget.ActionBar.Menu "> <item name=" Android:textsize ">18sp</item > <item name= "Android:textstyle" >normal</item> </style>
Apptheme.actionbar inheritance is very important, before detours has not found the correct parent, using Darkactionbar, it is clear that the internal icons and text are white, the gray point above the problem is solved, and then the size of the text can be used Actionmenutex Tappearance attribute customization, text bold change to normal, so that the expected effect is done
Related information:
How to Create a Material style Action Bar on KitKat and older Android versionsandroid app development styles and Themes (style,themes)
Change the color of the three dots on the right side of the Actionbar