【问题标题】:Font Typeface doesn't work字体字体不起作用
【发布时间】:2014-02-27 16:26:29
【问题描述】:
TextView tv=(TextView)findViewById(R.id.textView1); 
Typeface face=Typeface.createFromAsset(getAssets(), "font.ttf"); 
tv.setTypeface(face);

我无法看到 textview 字体已更改。我在资产文件夹中有“font.ttf”文件。 基本上,我打算在该文本视图(要求)中显示“乌尔都语”字样,因此在资产中添加了乌尔都语字体。然而它却用英文显示“WORD”。

感谢您的帮助。

【问题讨论】:

  • 如果TextView 的文本是"WORD",那么使用urdu 字体通常仍会显示"WORD"。只是看起来有点不同的角色。很少有字体没有拉丁字母(Windings & co.)。

标签: android fonts typeface


【解决方案1】:

Android 不支持全系列的 ttf 字体。 Here 是我个人在我的应用程序中使用的字体。尝试改用它。如果这个有效,而您的乌尔都语无效,那么您的代码是正确的,并且 Android 不支持您的字体。如果两者都不起作用,那么您的代码有问题。

【讨论】:

  • 谢谢,它成功了,我用这个 ds-digital 字体替换了 urdu 字体,我得到了结果。你能帮我找到适用于 android 的 urdu 字体吗?
  • 我不认为有任何与Android兼容的乌尔都语字体,或者如果有,我还没有遇到过。
【解决方案2】:
Typeface tf = Typeface.createFromAsset(getAssets(),
            "fonts/burnstown_dam.otf");
    TextView tv = (TextView) findViewById(R.id.CustomFontText);
    tv.setTypeface(tf);


    Typeface tf1 = Typeface.createFromAsset(this.getAssets(), "fonts/Jameel Noori Nastaleeq Kasheeda.ttf");
    TextView textView = (TextView)findViewById(R.id.CustomFontText);
    textView.setTypeface(tf1);
    textView.setText("Your Font Language Here");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-10
    • 1970-01-01
    • 2021-04-29
    • 2020-11-07
    • 1970-01-01
    • 2012-11-29
    • 2015-09-24
    相关资源
    最近更新 更多