Höhe der NavigationPage-Leiste unter Android
Dieser plattformspezifische Android-Wert legt die Höhe der Navigationsleiste auf einem fest NavigationPage
. Sie wird in XAML verwendet, indem die NavigationPage.BarHeight
bindbare Eigenschaft auf einen ganzzahligen Wert festgelegt wird:
<NavigationPage ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat;assembly=Xamarin.Forms.Core"
android:NavigationPage.BarHeight="450">
...
</NavigationPage>
Alternativ kann es über C# mithilfe der Fluent-API verwendet werden:
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat;
...
public class AndroidNavigationPageCS : Xamarin.Forms.NavigationPage
{
public AndroidNavigationPageCS()
{
On<Android>().SetBarHeight(450);
}
}
Die NavigationPage.On<Android>
-Methode gibt an, dass diese plattformspezifische App nur unter App compat Android ausgeführt wird. Die NavigationPage.SetBarHeight
-Methode im Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat
-Namespace wird verwendet, um die Höhe der Navigationsleiste in einem NavigationPage
festzulegen. Darüber hinaus kann die NavigationPage.GetBarHeight
-Methode verwendet werden, um die Höhe der Navigationsleiste im NavigationPage
zurückzugeben.
Das Ergebnis ist, dass die Höhe der Navigationsleiste auf einem NavigationPage
festgelegt werden kann: