【问题标题】:Badge count not displaying in Xamarin Forms徽章计数未显示在 Xamarin 表单中
【发布时间】:2018-06-04 12:19:15
【问题描述】:

我正在使用this 插件在选项卡上显示徽章计数。但有些如何它没有显示。我认为 Naxam.Bottombar.plugin 的问题用于在 android 的底部显示标签栏。因为如果我使用默认的 TabbedPage,那么它可以正常工作。我该如何解决这个问题?

我已按照徽章插件中描述的所有步骤进行操作。

代码:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         x:Class="Graysons.Views.MenuPage" 
         xmlns:local="clr-namespace:Graysons.Customs"
         xmlns:cc="clr-namespace:Graysons.Controls"
         xmlns:vm="clr-namespace:Graysons.ViewModels"  
         xmlns:convertors="clr-namespace:Graysons.Convertors"
         xmlns:controls="clr-namespace:CarouselView.FormsPlugin.Abstractions;assembly=CarouselView.FormsPlugin.Abstractions"
         xmlns:resources="clr-namespace:Graysons.StringResources"  
         xmlns:plugin="clr-namespace:Plugin.Badge.Abstractions;assembly=Plugin.Badge.Abstractions" 
         Title="Menus" Icon="ic_menus.png" plugin:TabBadge.BadgeText="1" plugin:TabBadge.BadgeColor="Red" plugin:TabBadge.BadgePosition="PositionBottomRight" plugin:TabBadge.BadgeMargin="15"
         Style="{StaticResource CustomTopBar}">
..............
</ContentPage>

还在AssemblyInfo.cs 文件中添加了用于渲染徽章计数的行。 任何帮助将不胜感激。

【问题讨论】:

标签: xamarin xamarin.forms xamarin.android


【解决方案1】:

以下渲染器要添加平台特定文件夹,不在主项目AssemblyInfo.cs中

[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]

例如:对于 iOS。

Sample.iOS/Properties/AssemblyInfo.cs

使用这个标题

using Plugin.Badge.iOS;

然后使用渲染器

[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]

适用于 Android。

Sample.Android/Properties/AssemblyInfo.cs

使用这个标题

using Plugin.Badge.Droid;

然后使用渲染器

[assembly: ExportRenderer(typeof(TabbedPage), typeof(BadgedTabbedPageRenderer))]

【讨论】:

    猜你喜欢
    • 2017-10-06
    • 1970-01-01
    • 1970-01-01
    • 2014-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-22
    • 2018-10-04
    相关资源
    最近更新 更多