I want to add the attribute windowDrawsSystemBarBackgrounds
programmatically, or in code, instead of the values-v21, because I only need it in 1 activity, and I'm using a theme selector in my app, so I can't have multiple themes.
Is possible to enable this attribute in the code? If so, then how can I do it?
Thanks in advance.
I found the answer:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(getResources().getColor(android.R.color.transparent));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With