question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ActionBar ActionItems : Popup menu icon & color is not setting

See original GitHub issue

Hi, I am trying to set action-items with popup menu (Like Menu list in Android). Snapshots are as follows :

menu Image 1

menu2 Image 2

Problem :
I want to set custom icons/drawables to action-item’s popup menu, but it’s not setting any icons and default color is black (see three dots in image 1 @ top right corner), i am not able to change color of popup menu’s icon.

I tried foll. code -

<ActionBar title="Compare">
  <ActionItem text="Export to PDF" icon="res://menu_white" ios.position="popup" android.position="popup">  </ActionItem>
   <ActionItem text="Settings" icon="res://menu_white" ios.position="popup" android.position="popup">  </ActionItem>
</ActionBar>

Is there any way to set custom icon for popup menus? or to set color for popup menu? The default color is black,but as i am having dark gray action bar, i want to set white color for popup menu (three dots). Please help me!

I want to achieve something like this - menu3

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:24 (4 by maintainers)

github_iconTop GitHub Comments

19reactions
ToniJMcommented, Jun 29, 2018

Hi, I found a way to modify only the color of the icon (three dots). After a lot of research, I found that this “popup” icon is called Overflow Button. Then the solution appeared in stackoverflow. https://stackoverflow.com/questions/35932669/how-do-i-change-the-action-bar-overflow-button-color

first you have to define the color (or you can use one of those that are already defined)

app\App_Resources\Android\src\main\res\values-v21\colors.xml

<resources>
	. . .
	<color name="my_white">#fff</color>
</resources>

Now you have to create a style that uses that color and then in the main theme of the app you have to apply that new style to the actionOverflowButtonStyle

app\App_Resources\Android\src\main\res\values-v21\styles.xml

<resources>
    <!-- Application theme -->
    <style name="AppTheme" parent="AppThemeBase">
        . . .
        <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item>
    </style>

    <!-- This style is where you define the tint color of your overflow menu button -->
    <style name="MyActionButtonOverflow" parent="@style/Widget.AppCompat.ActionButton.Overflow">
        <item name="android:tint">@color/my_white</item>
    </style>
</resources>

this works perfect for me, I hope it helps.

12reactions
vakrilovcommented, Jun 20, 2016

You cannot style the action popup action items and the overflow button with CSS currently. What you can do is to modify the actual android styles used in your app. The way to do that is to copy the values and values-v21 folders from your platforms folder (usually under <project>/platforms/android/src/main/res/ to App_Resources/android and modify the as you like. The modified styles will be used when you rebuild the app (just livesync will not be enough).

For example you can change the color of the overflow button by adding the folloing item in you AppTheme(styles.xml):

<item name="colorControlNormal">#fff</item>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set icon color of MenuItem? - android - Stack Overflow
ActionBar " as attribute on your Toolbar in your XML layout. If you want the toolbar popup menu to be light while the...
Read more >
Menus - Android Developers
The action mode is disabled and the contextual action bar disappears when the user deselects all items, presses the BACK button, or selects...
Read more >
App bars: top - Material Design
When using icons for navigation icons, action items and other elements of top app ... If not, an action bar will be added...
Read more >
Using the Android Toolbar (ActionBar) - Tutorial - Vogella.com
If the fill color does not fit to your styling, open the created drawable and adjust the color. 8.2. Add menu resources. Create...
Read more >
Action Bar | Android Developers
An action bar that includes the [1] app icon, [2] two action items, ... contextual action bar for displaying contextual action items, see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found