Xamarin.Forms FlyoutIcon 不显示(not shown)

升级了VS2019到16.4版本,然后默认创建了一个Xamarin Shell程序

结果运行后是这个样子

难道不应该是这个样子吗?

百了个度一晚上没解决,资料本身就少,再就是提示设置FlyoutIcon属性,可设置了也没用,后来科xue上web,发现了国外一个提问的

地址:https://github.com/xamarin/Xamarin.Forms/issues/8285

才发现是版本问题

Xamarin.Android中的Xamarin.Essentials包可以使用到1.3.0版本,再高了就冲突了

提示一下小白,如果无法直接降级到4.2.0.709249版本的话,就先移除了Xamarin.Essentials,降级后再添加

有更好的解决方案的劳烦回复一下,目前只能这样将就了。

好吧,找到问题所在了,没看完文档真可怕。。。

看看默认生成的AppShell.xaml大致是这个样子

<Shell xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:views="clr-namespace:Xaminals.Views"
       x:Class="Xaminals.AppShell">
    <TabBar>
        <Tab>
            <ShellContent>
                <views:CatsPage />
            </ShellContent>
        </Tab>
    </TabBar>
</Shell>

注意,用的是TabBar

发现这么个提示,(官方文档)关键字:单页应用程序禁用浮出控件

 去掉TabBar,使用ShellItem或FlyoutItem吧

(4.2.0.709249之前可以并存)

好了,问题终结了

原文地址:https://www.cnblogs.com/djd66/p/11994952.html