Nisar Ahmad
Nisar Ahmad

Reputation: 2067

How can i change status bar background color for api 11

I found code for lollipop

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        getWindow().setStatusBarColor(getResources().getColor(R.color.actionbar));
    }

But how to change status bar color for minSdkVersion 11

here is a view of my gradle file.

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.et.audionote"
    minSdkVersion 11
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

Upvotes: 0

Views: 482

Answers (3)

brahmy adigopula
brahmy adigopula

Reputation: 617

try with these following steps..hope you can get what do you want..i am just telling one way to change theme settings perminently.hope it'l work fine for you.

goto->tools->theme editor-> select api level and then take view of list given rightside and find like this option:: android:statusbarclor. after changed the theme clean the project and close the emulator and restart again. note:these settings for perimenent changes only.

Upvotes: 0

Dhaval Parmar
Dhaval Parmar

Reputation: 18978

setStatusBarColor Added in API level 21 android 5.0(lollipop),so you can not change StatusBarColor in pre-lollipop(android 5.0) OS version.

check documentation

Upvotes: 1

user5762284
user5762284

Reputation:

When you want to use Material Design features below Lollipop, you can benefit from additional libraries. One of them on ApacheLicense is here.

Upvotes: 2

Related Questions