1

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

万分感谢。

4

1 回答 1

1

You might be right about the font. When you have a String containing Korean characters, it is not necessarily supported by all font types. If you want to make sure, that those Strings get displayed properly, use your own font. Here you can find some font types that support Korean.

In another thread on SO, they discussed how to include your own font in Android. Basically there are these steps:

  1. copy the font in your project's folder (myProject/assets/fonts)
  2. load the font in your project
  3. set some text to use that font

Example:

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
}

Here is another example tutorial on how to use fonts. But the technique is basically the same.

于 2013-04-24T16:10:14.180 回答