so I would like to change the status bar color in my app to the value #65BC8D.
In the previous Android Studio versions I could change it in the Theme Editor but how do I change it directly in the styles.xml?
so I would like to change the status bar color in my app to the value #65BC8D.
In the previous Android Studio versions I could change it in the Theme Editor but how do I change it directly in the styles.xml?
Mostly this is the colorPrimaryDark
value if you are using the standard Material theme provided in the AppCompat themes. You can change that value to the hex value you want. E.g.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimaryDark">#65BC8D</item>
</style>
https://developer.android.com/guide/topics/ui/look-and-feel/themes#CustomizeTheme
Also take a look at the following picture (taken from https://forum.xda-developers.com/android/help/changing-colorprimary-colorprimarydark-t3813991) for a reference:
If you want to do it programatically then you can use,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = activity.getWindow();
// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// add FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag to the window
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// finally change the color
window.setStatusBarColor(ContextCompat.getColor(activity,R.color.my_statusbar_color));
};
Source - Change status bar color in Android