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.
android android-layout android-view material-design statusbar
Zaeem sattar
source share