I am building my first .NET MAUI app (only for Android) and I am running into some problems customising the TabBar. Below is what I am trying to achieve, with the 6 label-free tabs that navigate to various pages. However, the Shell TabBar only allows you to display 5 tabs before adding the "more" tab, which is what I'm trying to get rid of.
I have tried using a 3rd party TabBar like Syncfusion's Tab View, but found the extra rendering on my page's XAML file slows down the app navigation a lot, so I am really trying to get the MAUI Shell TabBar to work.
I am currently using a custom renderer (see below) for the Android platform to remove the tab labels, is there some way I can also force it to display all 6 tabs in the same custom renderer or perhaps using a handler?
namespace TaskFlow.Platforms.Android {
public class CustomShellRenderer : ShellRenderer
{
public CustomShellRenderer(Context context) : base(context)
{
}
protected override IShellBottomNavViewAppearanceTracker CreateBottomNavViewAppearanceTracker(ShellItem shellItem)
{
return new CustomBottomNavView();
}
}
public class CustomBottomNavView : IShellBottomNavViewAppearanceTracker
{
public void Dispose()
{
}
public void ResetAppearance(BottomNavigationView bottomView)
{
}
public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)
{
bottomView.ItemIconTintList = null;
bottomView.SetBackgroundColor(Color.ParseColor("#341C4F"));
bottomView.LabelVisibilityMode = LabelVisibilityMode.LabelVisibilityUnlabeled;
int[][] states = new int[][]
{
new int[] {-1},
};
int[] colors = new int[]
{
Color.White,
};
ColorStateList colorStateList = new ColorStateList(states, colors);
bottomView.ItemIconTintList = colorStateList;
}
}
}