Skip to content

Instantly share code, notes, and snippets.

@Taishi-Y
Last active March 11, 2023 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Taishi-Y/f054b650cc1fa3d4c7cc22db64256e13 to your computer and use it in GitHub Desktop.
Save Taishi-Y/f054b650cc1fa3d4c7cc22db64256e13 to your computer and use it in GitHub Desktop.
How to set statusbar color in Fragment
fun setStatusBarColor(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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment