How to remove (Android) app title bar in Xamarin.Forms?

Is there any chance that I can remove the title bar of the app in Xamarin.Forms? I am working on a Xamarin.Forms Portable project. I tried a lot of solutions, but neither worked, I couldn't even start the app.

First attempt I tried adding this to my AndroidManifest.xml, didn't work:

android:theme="@android:style/Theme.NoTitleBar"

Second attempt I tried creating a styles.xml in Resources/values, which was:

<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
  <style name="Theme.Default" parent="@android:style/Theme"></style>
  <style name="Theme.NoTitle" parent="@android:style/Theme.NoTitleBar"></style>
  <style name="Theme.FullScreen" parent="@android:style/Theme.NoTitleBar.Fullscreen"></style>
</resources>

And then I added this to my AndroidManifest.xml (didn't work either)

android:theme="@style/Theme.NoTitle"

Third attempt I tried adding this to my OnCreate method in MainActivity.cs (didn't work).

RequestWindowFeature(WindowFeatures.NoTitle);

Can anyone help me with this?

If you want to remove the title bar on the initial page, the quickest and easiest way to do it is to go to to the contentpage heading in your XAML for the page and type

NavigationPage.HasNavigationBar="False"

so the XAML would like something like this

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="YourClass.YourPage"
             NavigationPage.HasNavigationBar="False">

Hide Title Bar, When I navigate to a page, it displays a chunky bar with my page title. .com/​questions/37549364/xamarin-forms-uwp-hide-title-bar): image from one phone to another via bluetooth in xamarin android From this file I have copied the style for uwp:MasterDetailControl into the App.Xaml file within my  remove top bar on Android with xamarin forms. Adding a button to the title bar Xamarin Forms. 2 Xamarin.Forms Android project builds and runs locally on two

This can be done in PCL:

 var page = new LoginPage();
 NavigationPage.SetHasNavigationBar(page, false); // call this method every time before you push a page (no title bar)
 await navigation.PushAsync(page); 

If you are using old FormsApplicationActivity, try, add this in OnCreate(Bundle bundle) method

protected override void OnCreate(Bundle bundle)
{
    base.OnCreate(bundle)

    Forms.SetTitleBarVisibility(AndroidTitleBarVisibility.Never);
    Forms.Init(this, bundle);
}

This one seems do the app wide setting, but I am not so sure, as I don't use FormsApplicationActivity anymore.

[WORKING DEMO!!!] Xamarin, Introducing navigation function/code will automatically add a title bar (at the top). For this VLog Duration: 3:25 Posted: Dec 31, 2018 As far as I remember, in your Activity Class you have to remove the Attribute label there so that it won't have a title. I currently don't have Xamarin with me right now but I'm pretty sure there is an attribute above the class name that sets the Title.

Using the latest version of Xamarin.Forms I found that if you use:

await Navigation.PushAsync(new NextPage())

//Title on NextPage is displayed

await Navigation.PushModalAsync(new NextPage())

//Title on NextPage is not displayed

Nathan

HideTitleBar in Android, This article explains how to hide the Title Bar on Android. Android Studio is used to create the sample. TitleBar. The Title Bar contains the title of  One of the most common uses for the Toolbar is to replace the default action bar with a custom Toolbar (when a new Android project is created, it uses the default action bar). Because the Toolbar provides the ability to add branded logos, titles, menu items, navigation buttons, and even custom views to the app bar section of an Activity's UI

Theme = "@android:style/Theme.NoTitleBar" 

.

using Android.App;
using Android.OS;
using Android.Webkit;
using Android.Views;  // Webkit required for WebView

namespace LoadWebPage {
    [Activity(Label = "LoadWebPage", MainLauncher = true, Icon = "@drawable/icon", Theme = "@android:style/Theme.NoTitleBar")]
    public class Activity1 : Activity {
        protected override void OnCreate (Bundle bundle)

Replacing the Action Bar, The windowNoTitle attribute is set to true to hide the title bar: XML Copy XML Copy. <application android:label="@string/app_name" 

For iOS this single line (e.g. in the constructor of the page) works just fine.

NavigationPage.SetHasNavigationBar(page, false);

But Android is ignoring it, also when put in the XAML of the page.

As mentioned above by Bonelol this method has to be called each time before you push a page. I use Prism, so I can't access the creation and push of a page. So I just created a custom renderer for NavigationPage and put this line there. Maybe this will help someone else.

[assembly: ExportRenderer(typeof(NavigationPage), typeof(CustomNavigationRenderer))]
namespace MyApp.Droid.Renderer
{
    public class CustomNavigationRenderer : NavigationPageRenderer
    {
        public CustomNavigationRenderer(Context context) : base(context)
        {
        }

        protected override Task<bool> OnPushAsync(Page view, bool animated)
        {
            NavigationPage.SetHasNavigationBar(view, false);
            return base.OnPushAsync(view, animated);
        }                    
    }
}

Android Hide Title Bar Example, Android Hide Title Bar Example with examples of Activity and Intent, Fragments, Menu, Service, alarm xmlns:app="http://schemas.android.com/apk/res-auto" 

Hide Status Bar in Xamarin Forms for iOS and Android, iOS. Open your Info.plist and add the following lines: Status bar is initially hidden – Type Boolean – Value Yes; View controller- 

Android remove ActionBar / TitleBar, Android Action Bar. Posted by sapan on January 22, 2020 Xamarin I want to remove the action bar/ Title bar from my app to make it full 

38019 – Can't remove title bar in Material design, Material title bar repro (43.74 KB, application/zip) 2016-01-26 04:45 Fullscreen​); global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms. NoActionBar"> <item name="android:windowNoTitle">true</item> <item 

Comments
  • I'm not sure where I have to insert this code. Could you tell me where I should? I mean which file and which place (e.g. App.cs -> public App() method)
  • Did you edit it now? I can't see it, only the ones edited 10 hrs ago.
  • I couldn't figure out the PCL version yet, but the Android version works well, thank you!
  • This works well on my NextPage, but what about the page I navigate from?
  • This is the best answer especially when you have a first form which brings you to the next form with a Navigation Drawer