Android menu item background - android

I want to change the menu item background beacuse I use black icons, but on some phones the default color of background is black or other dark color. I tried this solution and it's worked but there was a little problen with it:
I have ten items and that's why I have a "More" item to show other options, but if I choose the More item (which is got the custom background) and after that I press back button, the item will be in the default state, default colors. What is the solution? Thanks!

The style attribute for the menu background is android:panelFullBackground. It's not hackish like the other solution, so it's not as buggy.
Despite what the documentation says, it needs to be a resource (e.g. #android:color/black or #drawable/my_drawable), it will crash if you use a color value directly.

try to use android own menu icon like as setIcon(android.R.drawable.ic_menu_search)

Related

Android Action Bar Drop Down Background Styling

I have an action bar that has a specific theme to it(some sort of color) that I want to apply to all activities/fragments that looks something like the attached picture.
Then once I click the dropdown, I'd like the dropdown background to be a different color. How would I go about styling that background.
Right now this is theme I have
<item name="toolbarTheme">#style/ThemeOverlay.AppCompat.Dark.ActionBar.WhiteDropDown</item>
Once I click the dropdown menu, the background of the dropdown appears to be black. What should I do to change that?
I've tried creating a subclass of #style/ThemeOverlay.AppCompat.Light and change the entire toolbarTheme to that style. But at the same time, the actionBar texts now all appear in black since its style is Light, and to contrast that, the texts will be black in default. Therefore, I'm wondering if there's any other attribute I can modify just to change the background of the dropdown menu.
I've tried, actionMenuTextColor, actionBarPopupTheme, spinnerDownItemStyle, actionBarItemBackground, actionDropDownStyle, and everything I can think of. Someone please help out!
Thanks!

Set color of ShareActionProvider

I defined a color for my whole app (a dark grey) and so when I click on the ShareActionProvider, a black list shows up but the text color is dark grey too (and so not really visible). The text in the ActionBar is white, but not the one in the list.
Is there any way I can set a different color (some item in styles.xml ?)
Thanks
Best way to customize shareActionProvider is create separate menu specifically for Sharing. See this link https://stackoverflow.com/a/22192759/1237175

Android Sub Menu Changes Background Color

I have an android application that I want to add a sub menu for. The background of the application is the default which is black. All of the text on the app is white which I also think is the default. So I added in the sub menu but when I click on the sub menu the background turns to white but the text doesn't turn to black.
Any idea why the default sub menu behavior isn't working correctly? I'm hoping not to have to create styles and all that and the solution will be fairly simple.
Figured this out. This was due to me using titleCondensed instead of just using title. For some reason on sub menus it needs to use title but on the regular menu it works fine. Programming mistake by me.

Change the selected item highlight colour for the hard-menu-key menu

I've used the action bar style generator to generate a custom action bar theme for an app, and it works well after a few tweaks. My custom theme is based on Holo (the dark version) and changes the highlight colours. My action bar overflow menu correctly shows my custom state_pressed colour on the overflow items when I press them. I've set android:colorPressedHighlight to the colour I want, and put an appropriate drawable for android:selectableItemBackground.
The problem is on one of my test devices, which has a hard menu button. (It's a Samsung Galaxy S III.) When I show the overflow menu with the hard menu button, pressing an item from this menu gives it the default blue highlight. Either it uses another attr instead of android:selectableItemBackground, or it's taking it from another style. I'd like to know what attr it's using, or what style it's taking it from, so that I can set this colour.
P.S. Before anyone suggests it, I know that you can use android:panelBackground to set the background of the bottom menu. But I don't want to change the overall menu background, only the item background.

How to change Menu item background color in android

In android 2.3 menu items are in black color and text in white color but i want change that color is possible?
Do you really want to change how the menu's look? I can't think of a single app that does that.
If you think you want to do this because your existing icons look bad, then you can create new versions of them and put them in /res/drawable-v9/ This will ensure that your new icons only show up in Gingerbread and higher.

Categories

Resources