答案 0 :(得分:2)
您可以使用Custom Renderers为TabbedPage
创建渲染器,然后在渲染器中编码,例如:
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;
}
}
}
}
}
您还可以参考我关于自定义TabbedPage
的其他案例:
How can I place a button in the the tabs of a TabbedPage in Xamarin.Forms?
答案 1 :(得分:1)
我认为您需要自定义样式并更改选项卡中的文本大小。
类似的东西:
<style name="MyTab" parent="@android:style/Widget.Holo.ActionBar.TabText">
<item name="android:textSize"></item>
</style>