I'm trying to make the status bar (in car's screen) to be transparent in my Android Auto app. I saw in the style guideline here link that developers are allow to do it but i can't find any document about how. Does anyone know how to do it?
Asked
Active
Viewed 395 times
2 Answers
1
Use the following piece of code inside your onCreate
method.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
0
Using setStatusBarColor Method
This method can be only used in the above API Level 21. Officially status bar color is not supporting below API Level 21. Although, Here we added an if condition.
if (Build.VERSION.SDK_INT >= 21) {
Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(ContextCompat.getColor(context, R.color.your_transparent_color));
}

Muhammad Riaz
- 79
- 5