-1

When I put the tabs at bottom, the icons shows only the silhouette. I just used this command to put the guide down.

Imagem sem bug Imagem com bug

Cfun
  • 8,442
  • 4
  • 30
  • 62
  • Have you tried to change the `BarBackgroundColor` of the TabbedPage? You will see it reappear. Here's a good resource https://montemagno.com/xamarin-forms-official-bottom-navigation-bottom-tabs-on-android/ – Saamer Aug 23 '20 at 16:40
  • Change to which color? – Gabriel Ribeiro Aug 23 '20 at 16:59
  • 38, 141, 222 or #268ede. BarBackgroundColor="#268ede" – Saamer Aug 23 '20 at 17:04
  • It just happened that the icons were colored, but they didn’t appear again as if they were tabbed on top – Gabriel Ribeiro Aug 23 '20 at 17:07
  • really, when i changed the UnselectedTabColor, even when the tab is at the top that the icons show, they stayed with the color that i defined, it can be something related to that when they are at the bottom – Gabriel Ribeiro Aug 23 '20 at 17:29

1 Answers1

0

If you want to use multicolored icon on the bottom navigation view, you have to create a custom renderer for tabbed page on Android and then change the configurations there:

[assembly: ExportRenderer(typeof(YourTabbedPage), typeof(MyTabbedPageRenderer))]
namespace TabbedDemo.Droid
{
  public class MyTabbedPageRenderer : TabbedPageRenderer
  {
    public MyTabbedPageRenderer(Context context) : base(context)
    {

    }

    protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
    {
        base.OnElementChanged(e);

        if (e.OldElement == null && e.NewElement != null)
        {
            for (int i = 0; i <= this.ViewGroup.ChildCount - 1; i++)
            {
                var childView = this.ViewGroup.GetChildAt(i);
                if (childView is ViewGroup viewGroup)
                {
                    for (int j = 0; j <= viewGroup.ChildCount - 1; j++)
                    {
                        var childRelativeLayoutView = viewGroup.GetChildAt(j);
                        if (childRelativeLayoutView is BottomNavigationView)
                        {
                            ((BottomNavigationView)childRelativeLayoutView).ItemIconTintList = null;
                        }
                    }
                }
            }
        }
     }
  }
}
Leo Zhu
  • 15,726
  • 1
  • 7
  • 23