For the status bar icons’ to have a dark tint instead of the default white, add the following tag in your styles.xml
(or more precisely in values-v23/styles.xml
) file:
<item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
You can also change the flag at runtime by setting it to any View
:
View yourView = findViewById(R.id.your_view);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (yourView != null) {
yourView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
}
}
If you want to reset the changes, clear the flag like this:
yourView.setSystemUiVisibility(0);