How to hide Android ActionBar in Xamarin.Forms?

How to hide ActionBar from Activity in Xamarin.Forms ? I tried the following, but none of this worked:

  • calling ActionBar.Hide() in OnCreate()
  • setting the theme to "@android:style/Theme.Holo.Light.NoActionBar"
+5
source share
3 answers

Just found a solution parallel to @Pete. This seems to be a bug in Xamarin.Forms at the moment.

I added this to my Styles.xml and installed the theme in my Activity :

 <?xml version="1.0" encoding="UTF-8" ?> <resources> <style name="NoActionBarTheme" parent="android:Theme.Holo.Light"> <item name="android:actionBarStyle">@style/invisible_action_bar_style</item> </style> <style name="invisible_action_bar_style" parent="android:Widget.Holo.ActionBar"> <item name="android:height">0dp</item> </style> </resources> 
+4
source

you can just hide it in your constructor

 public partial class MyPage : ContentPage { public MyPage() { NavigationPage.SetHasNavigationBar(this, false); InitializeComponent(); } } 
+6
source

The best way to hide an ActionBar with Xamarin.Forms:

 global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never); 
+1
source

Source: https://habr.com/ru/post/1205609/


All Articles