Xaml Xamarin表单中的徽章计数器不工作

Xaml Xamarin表单中的徽章计数器不工作,xaml,xamarin.forms,badge,Xaml,Xamarin.forms,Badge,我用这个在Xamarin表单应用程序的选项卡式视图中显示徽章数量 Xaml代码 <?xml version="1.0" encoding="utf-8"?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml&quo

我用这个在Xamarin表单应用程序的选项卡式视图中显示徽章数量

Xaml代码

<?xml version="1.0" encoding="utf-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:d="http://xamarin.com/schemas/2014/forms/design"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
            xmlns:plugin="clr-namespace:Plugin.Badge.Abstractions;assembly=Plugin.Badge.Abstractions"
            xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core" android:TabbedPage.ToolbarPlacement="Bottom"
            SelectedTabColor="{StaticResource HighlightText}"  BarBackgroundColor="{StaticResource HighlightBg}" UnselectedTabColor="Gray" 
            xmlns:views="clr-namespace:Sello.Views" x:Class="Sello.Views.MainPage" >
   <TabbedPage.Children>
        <NavigationPage Title="Home" IconImageSource="home.png">
                  <x:Arguments>
                <views:HomePage />
            </x:Arguments>
        </NavigationPage>

         <NavigationPage Title="Search" IconImageSource="search.png">
            
            <x:Arguments>
                <views:AboutPage />
            </x:Arguments>
        </NavigationPage>

         <NavigationPage Title="Cart" IconImageSource="cart.png"
             plugin:TabBadge.BadgeText= "2" 
             plugin:TabBadge.BadgeColor="Red"
              plugin:TabBadge.BadgeTextColor="White"   plugin:TabBadge.BadgePosition="PositionCenter"       >
            
            <x:Arguments>
                <views:AboutPage />
            </x:Arguments>
        </NavigationPage>


        <NavigationPage Title="Account" IconImageSource="account.png">
            
            <x:Arguments>
                <views:AccountPage />
            </x:Arguments>
        </NavigationPage>
    </TabbedPage.Children>
</TabbedPage>
添加此行时,将显示以下错误消息

找不到类型或命名空间名称“ExportRenderer”(是 是否缺少using指令或程序集引用?)

因此,当我对上面的行进行评论时,应用程序运行时没有错误,但是没有显示徽章。对于测试,我尝试在另一个测试应用程序上实现相同的功能,但也不起作用。 请帮我解决这个问题

找不到类型或命名空间名称“ExportRenderer”(是 是否缺少using指令或程序集引用?)

正如错误告诉您的,您缺少using指令。添加此项(将Android项目的iOS更改为Android)

您还需要确保在平台项目(iOS、Android等)而不是共享表单项目中执行此操作

有关示例,请参见

[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]
using Plugin.Badge.iOS;