【问题标题】:import fonts into eclipse to support unicode将字体导入eclipse以支持unicode
【发布时间】:2011-04-02 07:41:47
【问题描述】:

如何将音乐字体导入 Eclipse 以支持音乐 unicode?任何解决方法?

【问题讨论】:

    标签: android eclipse unicode fonts


    【解决方案1】:

    这是最简单的。

    在项目的根目录中创建一个名为 assets/fonts/ 的文件夹,然后粘贴 TTF 字体文件(在本例中为 Verdana.ttf)。然后,如果您想将该字体应用到 TextView,请执行以下操作:

    public class FontSampler extends Activity {
      @Override
      public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);
    
        TextView tv=(TextView)findViewById(R.id.custom);
        Typeface face=Typeface.createFromAsset(getAssets(),
                                              "fonts/Verdana.ttf");
    
        tv.setTypeface(face);
      }
    }
    

    此示例取自 ComonsWare 书(由 Mark Murphy 撰写)。你可以 download the full example from GitHub

    【讨论】:

    • @bamboolouie 很高兴您的回复
    猜你喜欢
    • 2017-12-13
    • 2016-09-01
    • 2010-12-19
    • 1970-01-01
    • 1970-01-01
    • 2012-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多