NAXAM / bottomtabbedpage-xamarin-forms

A page control for Xamarin.Forms to place tabs at the bottom.
Apache License 2.0
94 stars 32 forks source link

Setting Badges #14

Open craigathon opened 6 years ago

craigathon commented 6 years ago

Is it possible to set badges with this solution? I found it is exposed in bottomnavigationviewex but I'm not seing how to access the instance.

Is there a way I pull it out similar to FindViewById<BottomNavigationViewEx>(Resource.Id.bnve);

https://github.com/NAXAM/bottomnavigationviewex-android-binding/blob/72c6718d47f31ecd5f53cd14d51f094ade89694b/BottomNavExtentionExample/code/BadgeViewActivity.cs

tuyen-vuduc commented 6 years ago

Badges aren't supported by now. It'll be great if you could make a PR for that feature.

craigathon commented 6 years ago

@tuyen-vuduc I'll implement in my own project and see how it fits in. Thanks for the response.

Axemasta commented 6 years ago

@craigathon I am currently in the middle of combining this library with Xabre's badge library. I'll probably know on Monday whether the 2 are compatible, I'll keep you informed!

craigathon commented 6 years ago

@Axemasta Awesome, let me know if you need help checking anything out. I'm very interested in that approach. I too already use that badge library for iOS. The clean way badges can be set from xamarin forms is ideal.

Axemasta commented 6 years ago

@craigathon No luck so far, it seem that tab badge overrides bottomtabbedpage so that you get a nav bar with badges.... rendered at the top of the screen. I'm just sort of leaving the badge feature for android (as it's more important that the tab bar is at the bottom) and will visit it in my own time.

vivekshah-zymr commented 6 years ago

@craigathon @Axemasta @tuyen-vuduc I want to implement bottom tab bar with badges for Android and iOS platform, tried several ways but can't find a proper solution. Can anyone help me with this?

Phenek commented 5 years ago

Any workAround?

Axemasta commented 5 years ago

@vivekshah-zymr You can use Xabre's Tab Badge Library to add badges, it is not compatible with this library however.

My app sacrificed badges on android to have a bottom tabbed page (pre 3.1). You won't get badges with this library, you could try and combine the Xabre library with the new bottom nav that coems natively in Xamarin Forms.

Phenek commented 5 years ago

Hey @Axemasta, First thanks you bring me to the right Librairy 👍 Maybe you already known? But with Xamarin.Forms 3.x you can put the Android Tabbed page at the Bottom and it's official!

I found this https://montemagno.com/xamarin-forms-official-bottom-navigation-bottom-tabs-on-android/

And the Xabre's Tab Badge Library , they did a Pre-release 2.1.0-pre.3 to support it

Axemasta commented 5 years ago

@vivekshah-zymr @Phenek

You guys have probably overcome this issue by now but I thought I'd let you know anyway. I suggested the Xabre Plugin Badge Library and they now have full support for the native bottom tab page. This obviously invalidates this library (sorry guys) but everything this lib does is not available out of the box, thanks for the workaround!

All you need to do now is set the following attributes on your tabbed page:

On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
On<Xamarin.Forms.PlatformConfiguration.Android>().SetIsSwipePagingEnabled(false);
On<Xamarin.Forms.PlatformConfiguration.Android>().SetIsSmoothScrollEnabled(false);

You also need to set the LabelVisibilityMode (>= 28) or ShiftMode (>= 27). This is covered in a James Montemagno blog.

Now finally my app does on android what it's done on iOS for a while now! 😁