Well I've been trying to put the alpha to the status bar for a while but I can't do it, I would like to do the same as the toolbar with setAlpha()
toolbar.getBackground().setAlpha(intColor);
but it does not find a similar property for the status bar, try the following code but I have achieved my goal;
getWindow().setStatusBarColor(Color.alpha(intColor));
Thanks in advance.
Remember that it
window.setStatusBarColor()
works for Android 5.0 and later. Use the methodColor.argb()
to define thealpha
:Regarding the
getBackground()
del methodtoolBar
it is better to usesetBackgroundDrawable(colorDrawable);
You define a color in colors.xml to create the ColorDrawable:
you define an alpha between 0 and 255 for your
ColorDrawable
:you define the
ColorDrawable
to your toolBar:Try to add the color by Hexagesimal and by adding two more characters at the beginning you get the alpha. Here is a table about those two characters: