Xamarin Forms工具栏未在Android上显示

时间:2018-09-05 12:44:17

标签: c# xaml xamarin xamarin.forms

我有一个通过TabPage的子级访问的ContentPage,只需单击按钮即可访问它。 在iOS上,页面具有工具栏

iOS Toolbar

但是在Android上,没有显示。我必须依靠用户在其设备上使用后退按钮。

如何将其显示在Android上? 我试过使用一些修复程序,包括:NavigationPage.SetHasNavigationBar(this, true);,但这没什么区别。

1 个答案:

答案 0 :(得分:1)

要从选项卡启用分层导航,只需要将这些选项卡包装在NavigationPage中,如下所示:

public partial class TabPage : TabbedPage
{
    Page TabOne;
    Page TabTwo;
    Page TabThree;

    public TabPage()
    {
        TabOne = new NavigationPage(new TabOnePage());
        TabTwo = new NavigationPage(new TabTwoPage());
        TabThree = new NavigationPage(new TabThreePage());

        Children.Add(homePage);
        Children.Add(resourcesPage);
        Children.Add(helpPage);
    }
}

希望有帮助。

相关问题