I am using the app theme Theme.Black
in my app. In this theme the action bar is gray. How I can change color of my action bar? This is my attempt:
onclick buttons c2
to fetch and change the color of action bar and notification bar according to button's background, hope this helps
int color = c2.getBackground()).getColor();
int colorlighter = -color * 40 / 100 + color;
getWindow().setNavigationBarColor(colorlighter);
getWindow().setStatusBarColor(colorlighter);
ActionBar bar = getSupportActionBar();
bar.setBackgroundDrawable(new ColorDrawable(color));
colorlighter
is used to set color of notification bar a little lighter than action bar
color
is the background color of button c2
, according to which we change our color.