1

How i can create with xamarin shell (android and ios) the Google Map effect (show app in full screen but not hide the status bar). Thx.

Google Map screen capture

For Android i found:

In OnCreate method

Window.SetFlags(WindowManagerFlags.LayoutNoLimits, WindowManagerFlags.LayoutNoLimits);
Window.ClearFlags(WindowManagerFlags.TranslucentStatus);            
Window.SetStatusBarColor(Android.Graphics.Color.Transparent);

But I still need to change the color of the icons?

No solution for iOS yet!

Genry
  • 19
  • 1
  • 4

1 Answers1

0

For Android:

1.Change the style.xml

You can add the code into the Android styles.xml. This can make the status bar transparent.

<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
     <item name="android:windowTranslucentStatus">true</item>
</style>

2.Adding method in MainActivity.cs.

 protected override void OnCreate(Bundle savedInstanceState)
   {
       TabLayoutResource = Resource.Layout.Tabbar;
       ToolbarResource = Resource.Layout.Toolbar;
       base.OnCreate(savedInstanceState);

       Xamarin.Essentials.Platform.Init(this, savedInstanceState);
       global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

       if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat)
       {
           
           Window.AddFlags(WindowManagerFlags.TranslucentStatus);
           
           Window.AddFlags(WindowManagerFlags.TranslucentNavigation);
       }

       LoadApplication(new App());

For ios You can refer to this article .

For more details about this question:

Xamarin Forms Android transparent status bar

Guangyu Bai - MSFT
  • 2,555
  • 1
  • 2
  • 8