Android 上的 NavigationPage 栏高度NavigationPage Bar Height on Android
07/10/2018
本文内容
此 Android 平台特定的设置上导航栏的高度 NavigationPage 。This Android platform-specific sets the height of the navigation bar on a NavigationPage. 它通过将 NavigationPage.BarHeight 可绑定的属性设置为整数值,在 XAML 中使用:It's consumed in XAML by setting the NavigationPage.BarHeight bindable property to an integer value:
xmlns:android="clr-namespace::::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific.AppCompat;assembly=:::no-loc(Xamarin.Forms):::.Core"
android:NavigationPage.BarHeight="450">
...
此外,还可以使用 Fluent API 从 c # 使用该方法:Alternatively, it can be consumed from C# using the fluent API:
using :::no-loc(Xamarin.Forms):::.PlatformConfiguration;
using :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific.AppCompat;
...
public class AndroidNavigationPageCS : :::no-loc(Xamarin.Forms):::.NavigationPage
{
public AndroidNavigationPageCS()
{
On().SetBarHeight(450);
}
}
NavigationPage.On方法指定此平台特定的仅在应用程序兼容 Android 上运行。The NavigationPage.On method specifies that this platform-specific will only run on app compat Android. [ NavigationPage.SetBarHeight ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. AppCompat. NavigationPage (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。NavigationPage} (在命名空间中)) # A3 方法 :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific.AppCompat 用于设置上导航栏的高度 NavigationPage 。此外,[ NavigationPage.GetBarHeight ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. AppCompat. NavigationPage (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。NavigationPage} ) # A3 方法可用于返回中导航栏的高度 NavigationPage 。In addition, the NavigationPage.GetBarHeight method can be used to return the height of the navigation bar in the NavigationPage.
结果就是可以设置上导航栏的高度 NavigationPage :The result is that the height of the navigation bar on a NavigationPage can be set:
相关链接Related links