【问题标题】:android typeface fill transparent areas in ttfandroid字体填充ttf中的透明区域
【发布时间】:2014-02-14 10:51:55
【问题描述】:

我在我的应用程序中为我的字体使用 ttf。我使用的字体是这样的: http://www.dafont.com/unlearned-bitmap.font?nb_ppp=50

当我在 textview 上打印文本时,字体笔划内和周围的区域是透明的,所以我只看到字体的黑色笔划。当我设置 textview 的背景颜色时,黑色笔划内的区域是彩色的,笔划外的区域也是彩色的。有没有办法给字体内部着色,而不是笔划周围的区域?

【问题讨论】:

    标签: android truetype android-typeface


    【解决方案1】:

    是的,使用 setTextColor()

    Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "CustomFont.ttf");
    setTypeface(tf);
    yourTextView.setTextColor(Color.RED);
    

    【讨论】:

      【解决方案2】:
      Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "AnyFont.ttf");
      setTypeface(tf);
      textview.setTextColor(this.getResources().getColor(R.color.orange));
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-02
        • 2015-08-27
        • 1970-01-01
        • 2022-06-21
        • 2014-04-24
        相关资源
        最近更新 更多