2

I have used ShellRenderer but I am unable to get the code working to add an extra space between the bottom of the screen and the icons. Here is an image:

enter image description here

I need to increase the space between the bottom of the screen and the tab item titles.

Here is the code that I have tried:-

namespace MyProject.Droid.CustomRenderers
{
    public class CustomShellRenderer : ShellRenderer
    {
        public CustomShellRenderer(Context context) : base(context)
        {
        }

        protected override IShellTabLayoutAppearanceTracker CreateTabLayoutAppearanceTracker(ShellSection shellSection)
        {
            return new CustomBottomNavAppearance();
        }

        protected override IShellSectionRenderer CreateShellSectionRenderer(ShellSection shellSection)
        {
            return base.CreateShellSectionRenderer(shellSection);
        }

        protected override IShellItemRenderer CreateShellItemRenderer(ShellItem shellItem)
        {
            return base.CreateShellItemRenderer(shellItem);
        }
    }

    public class CustomBottomNavAppearance : IShellTabLayoutAppearanceTracker
    {
        public void Dispose()
        {

        }

        public void ResetAppearance(TabLayout tabLayout)
        {
        }

        public void SetAppearance(TabLayout tabLayout, ShellAppearance appearance)
        {

            for (int i = 0; i < tabLayout.ChildCount; i++)
            {
                var child = tabLayout.GetChildAt(i);
                child.SetPadding(0, 0, 0, 20);
            }
        }
    }
}

Let me know how can I fix this. Thanks!

Paul Kertscher
  • 9,416
  • 5
  • 32
  • 57
Nikhil
  • 3,387
  • 1
  • 8
  • 16
  • You should customize `ShellItemRenderer` . Check https://www.andrewhoefling.com/Blog/Post/xamarin-forms-shell-customizing-the-tabbar-android – Lucas Zhang Jan 27 '20 at 07:43

0 Answers0