Set Color of action bar menu - java

How can I programmaticly set the color of the action bar menu.
I am talking about the three vertical dots that appear on the top right of the action bar.
How can I set the color of this programatically.
Here is what I have tried
How do I change the background color of the ActionBar of an ActionBarActivity using XML?
How to change the background color of Action Bar's Option Menu in Android 4.2?
Thanks for the help.

Related

How to hide the search bar in the toolbar of my Android application?

I have a search bar in the toolbar of my application. How to hide the search bar in the toolbar temporarily? I want to hide it by default and show the title of the activity in the toolbar. When I want to search, the application is able to show the search bar again. What is the solution of this situation?
You can hide the search bar by setting it to be an icon by default. It will become an icon and the title of the activity can be shown in the toolbar. Later you can expand the icon to be the search bar again by clicking the icon and change it back to an icon by clicking the cross icon in the search bar.
searchView.setIconifiedByDefault(true);
searchView.setVisibility(View.GONE);
titleac.setVisibility(View.VISIBLE);
Try
searchbar.setVisibility(View.VISIBLE);
and
searchbar.setVisibility(View.INVISIBLE);

How to insert a picture in navigation bar android

Navigation bar vs toolbar i am trying to change my navigation bar a little bit. I want to insert a picture inside it and change the color but leave the back button there. What is the easiest way to do it? Thanks

set onPressed color action bar programmatically

I have done some research, looked at this question but it didn't have the answers I was looking for.
Change Action Bar onPressed color.
It is doing the same thing but is not what I am looking for, as I want to set the action bar color programatically, as I need to change the color by user preference. Here is how I get the action bar
ActionBar bar = getActionBar();
Any help with setting the color for when the back button or an item in the menu is tapped would be great. Thanks :)
to change actionbar background, try this
bar.setBackgroundDrawable(new ColorDrawable(0xff00DDED));
Put this code into your oncreate method:
ActionBar actions = getActionBar();
actions.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FF3300")));

The color of radio buttons of ListPrference has been changed to that of the background of the dialog

The buttons of my Listpreference have been concealed by the background of the dialog box which is white. I'm pretty sure changing the color of the button has to do with a style element, and I just can't figure out which one it is. How do I change the color of either the radio buttons or the background of the dialog?

How to change Android Notification bar, but color system bar at the bottom a different color

I am trying to stylize my application with notification bar tinting.
Unfortunately, when I color the notification bar, it colors the system bar (the bar with the home, back, and recent apps buttons at the bottom) the same color.
I am currently using the SystemBarTint library https://github.com/jgilfelt/SystemBarTint.
Any help would be appreciated!
Thank you!
I figured it out, this may not color the nav bar, but it gives me the desired result:
tintManager.setNavigationBarTintEnabled(false);
This line set the nav bar to clear, which was my desired result.
I also found:
tintManager.setNavigationBarTintColor(Color.BLACK);
which can set the nav bar to any color.
I am closing this question with this answer.

Categories