【问题标题】:how to increace font size in iphone , ipad mini and ipad tablet如何在 iphone 、 ipad mini 和 ipad 平板电脑中增加字体大小
【发布时间】:2016-11-11 09:11:36
【问题描述】:

我正在使用 Xlabs 字体管理器 和字体提供程序来增加字体大小 我在这方面取得了成功,但只有我在 iPad-mini 中面临的问题,字体大小没有变化。我用波纹管代码来改变字体大小

   private const short InitialSize = 18;

    /// <summary>
    /// Finds the closest.
    /// </summary>
    /// <param name="name">The name.</param>
    /// <param name="desiredHeight">Height of the desired.</param>
    /// <returns>Font.</returns>
    public Font FindClosest(string name, double desiredHeight)
    {
        var height = this.GetHeight(Font.OfSize(name, InitialSize));

        var multiply = (int)((desiredHeight / height) * InitialSize);


        var f1 = Font.OfSize(name, multiply);
        var f2 = Font.OfSize(name, multiply + 1);

        var h1 = this.GetHeight(f1);
        var h2 = this.GetHeight(f2);

        var d1 = Math.Abs(h1 - desiredHeight);
        var d2 = Math.Abs(h2 - desiredHeight);

        return d1 < d2 ? f1 : f2;
    }

iPhone 和 ipad 字体看起来很完美,但 iPad mini 字体看起来太小了

代码正确吗?

【问题讨论】:

    标签: xamarin.forms xlabs xamarin.forms.labs


    【解决方案1】:

    您可以尝试使用标准字体大小,而不是根据屏幕大小进行计算。试试这个:

    label.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
    

    您可以将其设置为小、中、大。我发现这对我的应用程序非常有用。更多详情请查看this link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-01-24
      • 2012-10-31
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      • 2020-12-13
      • 2012-02-17
      • 1970-01-01
      相关资源
      最近更新 更多