Created
September 7, 2020 17:39
-
-
Save suryaviyyapu/7f89e33450677c9ba5475bcd908e57ec to your computer and use it in GitHub Desktop.
Android: Set custom colors on status bar.
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
//Implement outside the onCreate method | |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public static void setStatusBarGradiant(Activity activity) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
Window window = activity.getWindow(); | |
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); | |
window.setStatusBarColor(ContextCompat.getColor(activity, R.color.colorPrimaryDark)); //Change colorPrimaryDark to customize | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment