Search code examples
javaandroidcolorsiconsstatusbar

How to change status bar icons color in Android?


I want to change the color of the status bar icon from white to my own custom color so that it works in all versions. I try the following code but I can not do it. could you help me, please?



The code I used, but this code is not the only solution for APIS + 23 and doesn't work for low API (API 16, API 17 and etc ).

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);

enter image description here



The color scheme I want to change.

color #5DD6D6

enter image description here


Solution

  • You can't actually change the status bar icon color in android like that. You can still change the status bar color to whatever you want, but for status bar icons, there are only 2 options - Light (white) or Dark (gray).

    If you want to use white icons, then simply put <item name="android:windowLightStatusBar">false</item> attribute in your base application theme. For dark icons <item name="android:windowLightStatusBar">true</item>

    You can also do it programmatically like mentioned here - https://stackoverflow.com/a/39596725/10357086