First of all it\'s not a duplicate as in How to change the background color of android status bar
How do I change the status bar color which should be same as in nav
You can use this simple code:
One-liner in Kotlin:
window.statusBarColor = ContextCompat.getColor(this, R.color.colorName)
Original answer with Java & manual version check:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getWindow().setStatusBarColor(getResources().getColor(R.color.colorAccentDark_light, this.getTheme()));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getResources().getColor(R.color.colorAccentDark_light));
}