Set color behind transparent status bar - android

I want to be able to change the color behind a transparent status bar.
I know how to change the status bar color, but then it becomes a solid color and and opening the navigation drawer no longer draws it behind the a translucent status bar.
The cyan color is the primary dark background color. The toolbar has been colored programatically to green, and making darkGreen the primaryDark color is not an option because there are other colors.
(Sort of like the Google+ App, where the Primary/PrimaryDark color seems to be able to change depending on what fragment is selected)
So how can I change the color behind the translucent status bar programatically on runtime, to green?

Related

Android Studio make status bar background complete transparent and change icon color

i need to make the status bar transparent, and change the icon color to a darker grey. Because i am using a viewpager and the layout must go below the status bar, i also tried it with
"windowTranslucentStatus=true"
But with it i cant change the color of status bar and it wasn't transparent, it was a darker grey and light transparent. And i want to change the color of the status bar in the layout when it is transparent. So i can create on the top of my layout, a view that has a height of 25dp and can change there the color, and when i am swiping, the color on the status bar should swiping too.
If im not doing this it look very terrible.
Thank you
Try this for status bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
}
Works with ActionBarActivity.

Transparent ActionBar: dynamically change color of back button to make it contrast to background

I have an application with trasparent Action Bar. Action Bar has one button - grey back arrow.
Under Action Bar there is big ImageView that shows the picture downloaded from web. And in case of this downloaded image is also grey, it is very hard to see grey arrow on transparent action bar.
Is it some way to pick the color from downloaded image and dynamically change back button color to contrast one?

CollapsingToolbarLayout: statusBarScrim for expanded state?

I'd like to use a CollapsingToolbarLayout to achieve an effect as in the following image:
To accomplish this, I first tried to set the status bar background color to a 30% opacity black in my theme. This works fine for the expanded state and achieves the intended effect.
However, I'd also like to use #color/primaryColorDark for the status bar as background when the CollapsingToolbarLayout is collapsed. So I set app:statusBarScrim to #color/primaryColorDark, but because the status bar background is set to semi-transparent black in the theme, the color is darker than #color/primaryColorDark.
How do I set a status bar scrim that is used when the CollapsingToolbarLayout is expanded? CollapsingToolbarLayout has app:statusBarScrim for the collapsed state, but there is no such attribute for the expanded state. If I could do this, I can set the status bar to fully transparent and avoid the problem of the overly dark status bar in collapsed state.
Alternatively, is there a way to only set the status bar background to transparent when the CollapsingToolbarLayout is collapsed?

Android 5.0: Recolor status bar icons

In my app, I am animating the status bar color between a dark blue color and white using Window.setStatusBarColor(). The icons in the status bar are initially white, like they should be. However, when I animate the background color to white, the icons stay white, making the contents of the status bar invisible. Is there a way to tell the system to recolor the things in the status bar to black?

Light-colored icon on ActionBar not visible on system menu?

I am using the ActionBarCompat sample. If our action bar has a dark background, we want to use white-colored icons. But these icons are also used for the system menu items (when they don't fit on the action bar, pre-honeycomb). So the white icons aren't visible on the system menu white background. Example:
What can we do about this? Is there a way to use the dark version of icons when shown on the system menu, and light colored when on the action bar?
Thanks
There are only two ways to handle this issue. Either change the color of your ActionBar, or edit the color of your icons.
I would suggest that best combination for Actionbar and icons would be Red color for Actionbar and white color for your icons.
And how can white icons be visible in white background??? If you remember in Menu icons we have grey background with white icons. That's why they are easily visible in Menu's.

Categories

Resources