Dương Lee
Dương Lee

Reputation: 56

Change Status bar's style on android auto

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?

Upvotes: 1

Views: 487

Answers (2)

Muhammad Riaz
Muhammad Riaz

Reputation: 129

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));
    }

Upvotes: 0

user5957595
user5957595

Reputation:

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);
}

Upvotes: 1

Related Questions