You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MAUI Entry控件在Android平台字体过小问题求助

MAUI Entry控件Android端字体过小的基础解决方案

方法1:通过OnPlatform指定平台专属字体大小

直接给Entry的FontSize属性分平台设置数值,确保Android端的字体大小达到预期显示效果,示例代码:

<Entry Placeholder="请输入内容">
    <Entry.FontSize>
        <OnPlatform x:TypeArguments="x:Double">
            <On Platform="iOS" Value="16" />
            <On Platform="Android" Value="18" />
        </OnPlatform>
    </Entry.FontSize>
</Entry>

方法2:检查Android模拟器的系统字体缩放

部分Android模拟器默认开启了高比例字体缩放,会导致控件字体显示异常。打开模拟器的设置-显示-字体大小,调回默认(100%)后重启模拟器再测试。

方法3:全局统一配置Entry字体大小

在Resources/Styles/Styles.xaml的默认样式中添加Entry的字体设置,不用每个控件单独配置:

<Style TargetType="Entry">
    <Setter Property="FontSize">
        <OnPlatform x:TypeArguments="x:Double">
            <On Platform="iOS" Value="16" />
            <On Platform="Android" Value="18" />
        </OnPlatform>
    </Setter>
</Style>

方法4:调整Android项目主题配置

如果以上方法无效,检查Android项目的主题设置:打开Platforms/Android/Resources/values/styles.xml,确认AppTheme的父主题是Maui.SplashTheme或Theme.MaterialComponents.Light.NoActionBar,避免自定义主题干扰字体渲染。

内容的提问来源于stack exchange,提问作者Dan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 05:33:11