Reputation: 125
Im having trouble with the text size of my Tabbar on Forms.Droid.
Does anyone know how to make the fontsize smaller, thus fixing this issue?
Thanks!
Upvotes: 2
Views: 2989
Reputation: 45
I think you need to custom style and change size of text in the tab.
Something like:
<style name="MyTab" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textSize"></item>
</style>
Upvotes: 1
Reputation: 16652
You can use Custom Renderers to create your renderer for TabbedPage
, and then in the renderer you can code for example like this:
public class StyledTabbedPageRenderer : TabbedPageRenderer
{
private Android.Views.View formViewPager = null;
private TabLayout tabLayout = null;
protected override void OnElementChanged(ElementChangedEventArgs<TabbedPage> e)
{
base.OnElementChanged(e);
this.tabLayout = (TabLayout)this.GetChildAt(1);
changeTabsFont();
}
private void changeTabsFont()
{
//Typeface font = Typeface.CreateFromAsset(Android.App.Application.Context.Assets, "fonts/" + Constants.FontStyle);
ViewGroup vg = (ViewGroup)tabLayout.GetChildAt(0);
int tabsCount = vg.ChildCount;
for (int j = 0; j < tabsCount; j++)
{
ViewGroup vgTab = (ViewGroup)vg.GetChildAt(j);
int tabChildsCount = vgTab.ChildCount;
for (int i = 0; i < tabChildsCount; i++)
{
Android.Views.View tabViewChild = vgTab.GetChildAt(i);
if (tabViewChild is TextView)
{
//((TextView)tabViewChild).Typeface = font;
((TextView)tabViewChild).TextSize = 6;
}
}
}
}
}
You can also refer to my other case about customize TabbedPage
:
How can I place a button in the the tabs of a TabbedPage in Xamarin.Forms?
Upvotes: 3