Cyanea
Cyanea copied to clipboard
Custom Status Bar Color
I want the status bar colour to match the Toolbar colour. How can I achieve that ? Is there any API for that or do I have to edit the plugin ?
I did that using Kotlin:
//Your statusBarColor method
//depends if you doing this in Activity or Fragment
fun Fragment.statusBarColor(@ColorInt color: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
activity?.window?.statusBarColor = color
}
}
And calling in Fragment or Activity:
statusBarColor(Cyanea.instance.primary)