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 :)
要更改操作栏背景,请尝试此
bar.setBackgroundDrawable(new ColorDrawable(0xff00DDED));
Put this code into your oncreate method:
ActionBar actions = getActionBar();
actions.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FF3300")));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.