Created
September 24, 2016 06:43
-
-
Save trinnguyen/07fb481ec2b5afae57b1d38d0a61ce67 to your computer and use it in GitHub Desktop.
Xamarin.Android SetStastusBarColor
This file contains hidden or 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
void SetStatusBarColor() | |
{ | |
if (Build.VERSION.SdkInt < BuildVersionCodes.Kitkat) | |
{ | |
return; | |
} | |
if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) | |
{ | |
Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); | |
Window.ClearFlags(WindowManagerFlags.TranslucentStatus); | |
Window.AddFlags(WindowManagerFlags.TranslucentNavigation); | |
Window.SetStatusBarColor(new Android.Graphics.Color(Android.Support.V4.Content.ContextCompat.GetColor(this, Resource.Color.colorPrimaryDark))); | |
} | |
else { | |
Window.AddFlags(WindowManagerFlags.TranslucentStatus); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment