Created
April 1, 2016 13:37
-
-
Save danielgomezrico/bffa2b216884e0a0d771eae27bcf7d18 to your computer and use it in GitHub Desktop.
Android - set status bar color programmatically (just for > lollipop)
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
public void setStatusBarColor(@ColorRes int statusBarColor) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
int color = ContextCompat.getColor(this, statusBarColor); | |
Window window = getWindow(); | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
window.setStatusBarColor(color); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment