Is there any way to remove the Navigation Bar from Xamarin.Forms - Portable (xaml) in Android?
I want to remove the "less than sign" ('<') and the application icon which appears above the content page of the Xamarin.Forms xaml.
Is there any way to remove the Navigation Bar from Xamarin.Forms - Portable (xaml) in Android?
I want to remove the "less than sign" ('<') and the application icon which appears above the content page of the Xamarin.Forms xaml.
You can remove navigation bar from Xaml using Xamarin.Forms using below code.
NavigationPage.SetHasNavigationBar (this, false);
Where this
stands for current page / form instance.
Hope this helps!
NavigationPage.SetHasNavigationBar(this, false);
The above mentioned is not the good solution.
By using this code it disable the NavigationBar
present in the page.
We can achieve the real solution only by creating a NavigationRenderer
for NavigationPage
for Android
.
void RemoveAppIconFromActionBar()
{
var actionBar = ((Activity)Context).ActionBar;
actionBar.SetIcon (new ColorDrawable (Color.Transparent.ToAndroid ()));
}
Refer the Github for the complete code snippet : https://gist.github.com/Vaikesh/f86d1968c8166519f102#file-customnavigationrenderer-cs
It's called the "back button" and it is available in the action bar. you can remove it using:
NavigationPage.SetHasBackButton(this, false);
The easiest way to achieve this is to add NavigationPage.HasNavigationBar = "false" in your ContentPage
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="SterlingSwitch.Pages.Page1"
NavigationPage.HasNavigationBar="False">
<ContentPage.Content>
<StackLayout>
<Label Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
The Best way to achieve this from xml page
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="ICLDC.Digital.General.Pages.AboutApp.AboutApplication"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:local="clr-namespace:ICLDC.Digital.General.Pages.Generic"
xmlns:translate="clr-namespace:ICLDC.Digital.General.Helpers"
ios:Page.UseSafeArea="True"
NavigationPage.HasNavigationBar="False">
<ContentPage.Content>
<StackLayout
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
Spacing="0"
VerticalOptions="FillAndExpand"/>
</ContentPage.Content>
</ContentPage>
© 2022 - 2024 — McMap. All rights reserved.
NavigationPage.HasNavigationBar="False"
in XAML inline with the ContentPage tag. – Steffy