File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,31 @@ static void PlatformSetColor(Color color)
4141
4242 if ( OperatingSystem . IsAndroidVersionAtLeast ( 35 ) )
4343 {
44+ const string statusBarOverlayTag = "StatusBarOverlay" ;
45+
4446 var window = Activity . GetCurrentWindow ( ) ;
45- window . DecorView . SetBackgroundColor ( platformColor ) ;
47+
48+ var decorGroup = ( ViewGroup ) window . DecorView ;
49+ var statusBarOverlay = decorGroup . FindViewWithTag ( statusBarOverlayTag ) ;
50+
51+ if ( statusBarOverlay is null )
52+ {
53+ var statusBarHeight = Activity . Resources ? . GetIdentifier ( "status_bar_height" , "dimen" , "android" ) ?? 0 ;
54+ var statusBarPixelSize = statusBarHeight > 0 ? Activity . Resources ? . GetDimensionPixelSize ( statusBarHeight ) ?? 0 : 0 ;
55+
56+ statusBarOverlay = new ( Activity )
57+ {
58+ LayoutParameters = new FrameLayout . LayoutParams ( Android . Views . ViewGroup . LayoutParams . MatchParent , statusBarPixelSize + 3 )
59+ {
60+ Gravity = GravityFlags . Top
61+ }
62+ } ;
63+
64+ decorGroup . AddView ( statusBarOverlay ) ;
65+ statusBarOverlay . SetZ ( 0 ) ;
66+ }
67+
68+ statusBarOverlay . SetBackgroundColor ( platformColor ) ;
4669 }
4770 else
4871 {
You can’t perform that action at this time.
0 commit comments