【问题标题】:Xamarin Form - How to change TabbedPage title font size in ResourceDictionaryXamarin Form - 如何在 ResourceDictionary 中更改 TabbedPage 标题字体大小
【发布时间】:2018-09-17 19:37:25
【问题描述】:

我创建了一个TabbedPage 和四个ContentPages 作为TabbedPage.ChildrenTitle。 iOS 应用程序中呈现的Titles 非常完美,可以阅读。但是,在 Android 中,Title 字体似乎太大而无法显示,即使我在 Android 设备的设置中更改了首选项字体大小。

这是我的 TabbedPage XAML 文件

<?xml version="1.0" encoding="UTF-8"?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" 
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
            xmlns:local="clr-namespace:MyApplication.Views;assembly=MyApplication"
            x:Class="Demo.TabbedPageView"
            Title="My Application">
    <TabbedPage.Children>
        <local:View One/>
        <local:View Two/>
        <local:View Three/>
        <local:View Four/>
    </TabbedPage.Children>
</TabbedPage>

标签页截图

iOS - https://ibb.co/fmCZcH

Android - https://ibb.co/drEQjx

我的问题是

  1. 如何更改TitleResourceDictionary 中的字体大小?
  2. 在这种情况下,还有其他方法可以实现相同的目标吗?

【问题讨论】:

    标签: xaml user-interface xamarin.forms resourcedictionary


    【解决方案1】:

    您可以使用自定义样式并更改选项卡的文本大小。
    看到这个How to use custom style for tab

    并改变风格:

    <style name="CustomTab" parent="@android:style/Widget.Holo.ActionBar.TabText">
        <item name="android:textSize">5sp</item>
    </style> 
    

    【讨论】:

    • 我意识到它只能通过从本机项目代码进行编辑来完成,而不能在 Xamarin.Form 项目本身中进行。不管怎样,谢谢你的回答。
    猜你喜欢
    • 2020-05-16
    • 1970-01-01
    • 1970-01-01
    • 2017-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-11
    • 2017-02-22
    相关资源
    最近更新 更多