0

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'
    }
}

}

Nisar Ahmad
  • 1,987
  • 3
  • 13
  • 30
  • I don't think you can do it below lollipop – Vivek Mishra Feb 22 '16 at 09:06
  • Possible duplicate of [How to change the status bar color in android](http://stackoverflow.com/questions/22192291/how-to-change-the-status-bar-color-in-android) – kevz Feb 22 '16 at 09:24

3 Answers3

2

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

  • while using this lib i'm getting this error "attribute ripplecolor has already been defined"to use this lib did i need to remove this dependincy."compile 'com.android.support:design:23.1.1'"? – Nisar Ahmad Feb 22 '16 at 10:23
  • is there is any other lib for material design .. to set status bar color – Nisar Ahmad Feb 22 '16 at 10:27
  • As was noticed in the comments, you can't change status bar color below Lollipop. With Material Design Library you can use material design features except status bar color. –  Feb 22 '16 at 11:21
1

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

Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
0

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.

brahmy adigopula
  • 617
  • 3
  • 15