Reputation: 13313
I'm struggling with the dumbest thing (I guess I'm just not used to the Xamarin Designer).
How can I remove the title of my app ? It keeps showing up but it is not in my Layout Source.
I want to remove this whole part but can't figure out how.
In C# Winforms or WPF I would have selected the whole window or screen and then accessed the main window properties but in this case, I can only select the controls I added (buttons and labels) and not the whole screen or the title.
Upvotes: 36
Views: 39856
Reputation: 21452
You can achieve that by create custom style:
<style name="AppTheme" parent="AppTheme.Base"/>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/colorPrimary</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<!-- colorAccent is used as the default value for colorControlActivated,
which is used to tint widgets -->
<item name="colorAccent">@color/colorAccent</item>
</style>
And here how you can use it in your activity:
[Activity(Label = "ActivityLabel", Theme = "@style/AppTheme")]
Upvotes: 4
Reputation: 1
Just put this NavigationPage.HasNavigationBar="False"
under your ContentPage
It works in the latest versions
Upvotes: 0
Reputation: 1
Just add this to app style (Resources/values/styles.xml):
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
Should look like:
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
Upvotes: 0
Reputation: 2377
[2021] You can set the theme as following:
[Activity(Label = "@string/app_name", Theme = "@style/Theme.AppCompat.Light.NoActionBar", MainLauncher = true)]
Upvotes: 0
Reputation: 1
To remove the title bar, I just changed the "Style.xml" file:
Add this line in below other items:
<item name="windowNotitle">true</item>
This will remove the title bar from the "AppTheme", you can also create a custom theme next to it in and set it in your activity.
Upvotes: 0
Reputation: 158
SupportActionBar.Hide();
worked to hide the entire title bar for me.
Upvotes: -1
Reputation: 97
This worked for me:SupportActionBar.SetDisplayShowTitleEnabled(false);
Upvotes: 0
Reputation: 37
In my case I dont't need any Title, I just want an ActionBar with some Tabs so I wrote:
RequestWindowFeature(Android.Views.WindowFeatures.ActionBar);
And after SetContentView:
ActionBar.Title = "";
Upvotes: 1
Reputation: 5036
The option which to me seems the simplest is to edit the Activity
attribute and use a default style (rather than a custom one, as suggested by Mina Fawzy):
[Activity(Theme = "@android:style/Theme.DeviceDefault.NoActionBar", ...)]
If you want to remove the status bar too then use
[Activity(Theme = "@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen", ...)]
Upvotes: 10
Reputation: 11233
Lots of expectable answers!
However, just in case if it's still not working because let's say you're setting custom views. Try ActionBar.Title = null;
Upvotes: -1
Reputation: 915
Don't change it in Title theme, it will accept previous version ui.
After OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle); //
Window.RequestFeature(WindowFeatures.NoTitle); //This will Hide the title Bar
}
Alternatively, you could add
NavigationPage.SetHasNavigationBar(this, false);
to your constructor
Upvotes: 10
Reputation: 10865
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.
UPDATE from phadaphunk:
Remove android:theme="@android:style/Theme.NoTitleBar" from the manifest file will completely remove the title
UPDATE
NavigationPage.SetHasNavigationBar(this, false);
At the time I wrote the answer, the best answers that are given now are available to the framework. Correct me if I'm wrong but I don't remember those API being available at the time of this writing.
Upvotes: 23
Reputation: 969
NavigationPage.SetHasNavigationBar(this, false);
Is the best method.
Upvotes: 3
Reputation: 2649
Write this in the OnCreate
method just after SetContentView
:
ActionBar.Hide();
Upvotes: 37