Status Bar Color not showing - 5.0 Lollipop Android Studio: (AppCompat-v7:r21)

前端 未结 11 1337
-上瘾入骨i
-上瘾入骨i 2020-12-23 20:02

I\'m using the AppCompat-v7:21.0.0 support library for Android 5.0 Lollipop in Android Studio. My problem is that the Status Bar Color that can be changed by se

11条回答
  •  天涯浪人
    2020-12-23 20:47

    This worked for me:

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

提交回复
热议问题