0

I am working on Xamarin forms, it seems I need to adjust the FontSize for text in each tabs when I have to include a number of tabs for TabbedPage.

Problem: How to adjust the fontsize for the Tabs?

I tried to use the properties of the tab, but there is none.

public Product()
{
    InitializeComponent();  

    this.title = ??
}



<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"          
            xmlns:local ="clr-namespace:MyApp.View"  
            BackgroundColor="White"
            Title="Product and Service"          
            x:Class="MayApp.View.MainMenu">
    <ContentPage.ToolbarItems>
        <ToolbarItem Name="MenuItem1" Order="Primary" Icon="itemIcon1" Command="{Binding Item1Command}"  Priority="0" />
        <ToolbarItem Name="MenuItem2" Order="Primary" Icon="itemIcon2" Priority="1" />
    </ContentPage.ToolbarItems>

    <local:Product>
    </local:Product>

    <local:Service>
    </local:Service>   

</TabbedPage>
MilkBottle
  • 4,242
  • 13
  • 64
  • 146

1 Answers1

0

To change this for iOS you will need a custom renderer with code that iterates over the TabBar items and changes their font size using UITextAttributes. There is no way to do it in Xamarin.Forms itself.

if (TabBar.Items != null)
{
    foreach (var t in TabBar.Items)
    {
        var fontSize = new UITextAttributes() { Font =   UIFont.SystemFontOfSize(15) };
        t.SetTitleTextAttributes(fontSize, UIControlState.Normal);
    }
}
Steven Thewissen
  • 2,971
  • 17
  • 23