When I open my application for a second it shows the status bar in blue color, even though, I declared the color to be RED.
In styles:
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor">@color/colorPrimaryDark</item>
</style>
</resources>
In Colors.xml
<resources>
<color name="colorPrimary">#a20dff</color>
<color name="colorPrimaryDark">#ff0000</color>
<color name="colorAccent">#FF4081</color>
</resources>
It's worth mentioning that I change the color grammatically to another color(specified by user) later.But, as in very first second it is different it looks ugly.
Try with adding below line to your v21 theme:
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
OR
You can do it by programmatically like below:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.BLUE);
}