Replies: 2 comments 2 replies
-
The same code probably works in .NET MAUI also, but where to put it is the question. Tell me more about your platform-specific implementation? Is it like this? https://www.xamboy.com/2018/03/08/adding-badge-to-toolbaritem-in-xamarin-forms/ /cc @PureWeen |
Beta Was this translation helpful? Give feedback.
-
Hi @davidortinau , today, with the help of my work team, we found a solution for this implementation for Android that works! We have this method implemented in a public class named ToolbarItemBadge for Android platform, which is call from a maui common class to set the counter notifications: `public class ToolbarItemBadge : IToolbarItemBadgeService public void SetBadge(Page page, ToolbarItem item, int value)
} Inside the BadgeDrawable class, we have this other method called SetBadgeText that follows: `public class BadgeDrawable : Drawable public override int Opacity => (int)Format.Unknown; public BadgeDrawable(Context context, Color backgroundColor, Color textColor)
} public override void Draw(Canvas canvas)
} private void SetBadgeText(int text) public static void SetBadgeText(Context context, IMenuItem item, int text, Color backgroundColor, Color textColor)
} public override void SetAlpha(int alpha) { } These implementations solved our problem. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, hope you are doing great!
I have an application in Net Maui 8 which was migrated from Xamarin Forms.
In the app, there are some icons in toolbar with a flyout menu (the app does not use shell navbar).
When in xamarin, It was possible to define and show notification badges over icons by using drawables for specific platform as android, for example. But when it's about net maui, there is only documentation explaining how to include notification badges over app icon, but not over toolbar items inside the app pages.
So far, I couldn't find any docs about this kind of implementation.
Do anyone have some tips for that case, please?
I attached an example about where do I need to show the badges, over the bell icon.
Beta Was this translation helpful? Give feedback.
All reactions