【问题标题】:Line break after back button - Xamarin Forms后退按钮后换行 - Xamarin Forms
【发布时间】:2019-11-08 16:51:13
【问题描述】:

我是 Xamarin 表单的新手,并且已从我的主页定向到导航页面,我希望标题与后退按钮出现在同一行,但它目前出现在下面的行中,如下所示 -

https://i.imgur.com/lpsJjle.png

我正在使用下面的代码来显示标题-

<NavigationPage.TitleView>
    <StackLayout>
        <Label 
            Text="About" TextColor="{StaticResource lightGreen}">
            <Label.FontFamily>
                <OnPlatform x:TypeArguments="x:String"
                                Android="GothamRoundedMedium.ttf#GothamRoundedMedium"
                                iOS="GothamRoundedMedium">
                </OnPlatform>
            </Label.FontFamily>
        </Label>
    </StackLayout>
</NavigationPage.TitleView>

这个代码导航到关于页面 -

Navigation.PushAsync(new NavigationPage(new Survey2()));

任何帮助将不胜感激!

【问题讨论】:

  • 您有一个 NavigationPage 嵌套在另一个 NavigationPage 中 - 不要那样做。只需执行 Navigation.PushAsync(new Survey2());
  • 成功了,谢谢!

标签: xaml xamarin xamarin.forms


【解决方案1】:

使用new NavigationPage,您将再次创建一个新的 NavigationPage。

所以,只需使用:

Navigation.PushAsync(new Survey2());

如果你需要使用 Modal,使用这个:

Navigation.PushModalAsync(new NavigationPage(new Survey2()));

【讨论】:

    猜你喜欢
    • 2016-10-23
    • 1970-01-01
    • 2015-12-12
    • 2016-10-26
    • 2014-09-16
    • 1970-01-01
    • 1970-01-01
    • 2021-04-29
    • 1970-01-01
    相关资源
    最近更新 更多