Hello,
Welcome to our Microsoft Q&A platform!
Once we put the navigation at the bottom, the tab has been changed to BottomNavigationView. We need to use a custom renderer of the Tabbed Page to change the font of the title on the bar. Here is the code.
[assembly: ExportRenderer(typeof(MyTabbedPage), typeof(MyTabbedPageRenderer))]
namespace Sample.Droid
{
public class MyTabbedPageRenderer : Xamarin.Forms.Platform.Android.AppCompat.TabbedPageRenderer
{
Context context;
public MyTabbedPageRenderer(Context context) : base(context)
{
this.context = 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 bottomBar)
{
for (int k = 0; k < bottomBar.Menu.Size(); k++)
{
IMenuItem menuItem = bottomBar.Menu.GetItem(k);
SpannableString spanString = new SpannableString(menuItem.TitleFormatted.ToString());
spanString.SetSpan(new RelativeSizeSpan(0.5f), 0, spanString.Length(), SpanTypes.ExclusiveExclusive);
menuItem.SetTitle(spanString);
}
}
}
}
}
}
}
}
}
Change the multiplier to meet your request:
spanString.SetSpan(new RelativeSizeSpan(0.5f), 0, spanString.Length(), SpanTypes.ExclusiveExclusive);
Best Regards,
Jessie Zhang
---
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.