Last active
March 11, 2023 11:43
-
-
Save Taishi-Y/f054b650cc1fa3d4c7cc22db64256e13 to your computer and use it in GitHub Desktop.
How to set statusbar color in Fragment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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