如何使用 xamarin.forms 不在导航栏上显示图标?

How to not display icon on nav bar with xamarin.forms?

我想在我的应用程序上有一个底部导航栏。但是当我使用标签页时,应用程序中显示的内容必须是导航栏上的标签之一。

<TabbedPage>

    <TabbedPage.Children>

        <!--<NavigationPage Title="test" IsVisible="False">
            <x:Arguments>
            <ContentPage>
                <Label Text="Not display this on nav bar but show its content page"/>
            </ContentPage>
            </x:Arguments>
        </NavigationPage>-->

        <NavigationPage Title="{x:Static Resource:AppResource.PaginaInicialTitulo}" Icon="homeBlack.png">
            <x:Arguments>
                <views2:ComoTeSentesPage/>
            </x:Arguments>
        </NavigationPage>

        <NavigationPage Title="{x:Static Resource:AppResource.CalendarioTitulo}" Icon="calendarBlack.png" BarBackgroundColor="White">
            <x:Arguments>
                <views:PaginaInicial/>
            </x:Arguments>
        </NavigationPage>

        <NavigationPage Title="{x:Static Resource:AppResource.ConviteTitulo}" Icon="phoneBlack.png">
            <x:Arguments>
                <views:PaginaInicial/>
            </x:Arguments>
        </NavigationPage>
    </TabbedPage.Children>
</TabbedPage>

我想为页面显示不同的内容,而不是所选选项卡之一的内容。通过这样做,导航栏可以在应用程序的每个页面上都可见,并且每个页面的内容显示不会链接到选项卡内容。

编辑: 在这张照片中,它显示了我的目标。有底部导航栏,但 none 个选项卡被选中,显示的内容与导航栏中的任何选项卡都不相关。 但是在我的项目中,页面中显示的内容总是与导航栏中的其中一个选项卡相关。

我基于 navigation-inside-a-tab 示例编写了一个简单的演示。

  1. 我通过添加使标签栏底部:

    xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
    android:TabbedPage.IsSwipePagingEnabled="False"
    android:TabbedPage.ToolbarPlacement="Bottom"
    
  2. 我把todayPage改成了carousel-page.

  3. 我还在todayPage中添加了一个导航行为

我上传到Github,你可以下载:tabbedPage-Naviagtation-CarousePage

结果如下: