Change the color of the three dots on the right side of the Actionbar

Source: Internet
Author: User

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" &GT;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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.