【问题标题】:How to display Korean Words in android app如何在安卓应用中显示韩语单词
【发布时间】:2013-04-18 05:57:51
【问题描述】:

在部分未安装韩文字体的安卓手机上,在安卓应用中显示韩语单词时,无法正常显示。如何处理android应用程序中的这种情况?有没有方便的方法来解决这个问题?我的应用程序必须安装韩文字体吗?我是android的初学者,我有点困惑,如果所有韩语字符串都用Unicode编码,它们不应该显示为可读吗?

非常感谢。

【问题讨论】:

    标签: java android user-interface unicode fonts


    【解决方案1】:

    您对字体的看法可能是正确的。当您有一个包含韩语字符的String 时,它不一定被所有字体类型支持。如果您想确保那些Strings 正确显示,请使用您自己的字体。 Here you can find some font types that support Korean

    another thread on SO 中,他们讨论了如何在 Android 中包含您自己的字体。基本上有这些步骤:

    1. 复制项目文件夹中的字体 (myProject/assets/fonts)
    2. 在项目中加载字体
    3. 设置一些文本以使用该字体

    示例:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        Typeface myTypeFace = Typeface.createFromAsset(getAssets(), "fonts/myKoreanFont.ttf");      // that's how you load your font
        TextView myTextView = (TextView) findViewById(R.id.myKoreanText);
        myTextView.setTypeface(myTypeFace);        // that's how you use your font
    }
    

    这里是另一个example tutorial,关于如何使用字体。但技术基本相同。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多