Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin表单-将页面标题设置为Android中心_Android_Xaml_Xamarin.forms - Fatal编程技术网

Xamarin表单-将页面标题设置为Android中心

Xamarin表单-将页面标题设置为Android中心,android,xaml,xamarin.forms,Android,Xaml,Xamarin.forms,为了保持跨平台的一致性,有没有可能让页面标题显示在Android的中心,类似于iOS上的页面标题 <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xama

为了保持跨平台的一致性,有没有可能让页面标题显示在Android的中心,类似于iOS上的页面标题

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
             x:Class="gl_mobile_app.Views.Map.MapPage"
             NavigationPage.HasNavigationBar="True"
             Title="Map" >

    <ContentPage.ToolbarItems>
        <ToolbarItem x:Name="backItem" 
                     Text="Back" 
                     Clicked="GoBack" />
    </ContentPage.ToolbarItems>

如果您使用的是基于的Xamarin.forms应用程序,那么您可以通过使用、定义标题内容、绑定标题内容,甚至根据需要设置样式来轻松实现这一点

内容页中

<Shell.TitleView>
    <Label Text="Map" HorizontalTextAlignment="Center" HorizontalOptions="CenterAndExpand"/>
</Shell.TitleView>

这样可以避免使用自定义渲染器


此外,如果你需要根据平台进行一些特殊调整,你可以使用。

如果你想通过这种“一致性”迫使Android用户使用一个看起来像IOS的应用程序,这对他来说是非本地和非自然的,你会遇到很多问题。XF的主要目标是使应用程序在每个平台上看起来都是本地的。Fair point,我会把它带回请求它的人那里,这是最好的选择!应用程序用户界面可以是“跨平台一致的”,但是,行为和常见元素,如对话框和页面标题上的答案按钮位置,我不这么认为。=)如果你觉得我的回答有帮助,请。