MAUI 应用程序底部的 TabBar

djs*_*fey 8 .net c# maui

我使用默认应用程序在 Visual Studio 中创建了一个新的 MAUI 应用程序。我试图在底部添加一个 TabBar,但它总是出现在顶部(参见屏幕截图)。我见过的所有示例和我读过的文档都表明它应该位于底部。我究竟做错了什么?这是在 Windows 上。

这是AppShell.xaml

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="letseat.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:letseat"
    >


    <TabBar Route="Home">
        <Tab Icon="dotnet_bot.png" Title="Main">
            <ShellContent ContentTemplate="{DataTemplate local:MainPage}"/>
        </Tab>
        <Tab Icon="dotnet_bot.png" Title="Profile">
            <ShellContent ContentTemplate="{DataTemplate local:ProfilePage}"/>
        </Tab>
        <Tab Icon="dotnet_bot.png" Title="Test">
            <ShellContent ContentTemplate="{DataTemplate local:ProfilePage}"/>
        </Tab>
    </TabBar>
</Shell>
Run Code Online (Sandbox Code Playgroud)

以及结果 截图

Jos*_*all 0

你没有做错什么。

看起来这个错误已经存在了近一年了,不幸的是,它的优先级似乎很低。

但是,它仍然在 Android 模拟器 (pixel 5 API 33) 的底部显示选项卡。因此,截至(2023 年 4 月 25 日),它仍然是一个错误,预计不会很快修复(根据 2022 年 8 月 30 日的问题说明,“即将发布的版本不会对其进行处理”)

Android 与 Windows 选项卡渲染的屏幕截图