How to change the color of the Android status bar to white and the color of the status bar icon to gray

I am trying to change the color of my status bar to white with gray icons. I tried almost all the solutions for this problem, but not all of them worked for me.

I use this java fucntion to modify it, and I also post my style code (21).

public static void statusBarColor(Window window, Context ctx) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { //Window window = getActivity().getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(ctx.getResources().getColor(R.color.statusbar_color)); } } 

this is my java code but it does not work after a thousand attempts. and below my .xml style (21)

  <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/transparent</item> <item name="android:windowLightStatusBar" tools:targetApi="23">true</item> </style> 

If you think its a duplicate of some other question, then I must let you now, I tried 3.4 pages of Google search, and also implemented them.

+3
android android-layout android-view material-design statusbar
source share
1 answer

This flag is reached:

 <item name="android:windowLightStatusBar">true</item> 

Unfortunately, it is available up through API 23, so you must specify it in values-v23/styles.xml . See more details.

There is no backport for this function, so it will not work on any lower 23 while writing this.

enter image description here

+3
source share

All Articles