Textview正确显示编码文本

时间:2012-09-17 15:49:18

标签: android encoding character-encoding

我有一个应用程序,读取加载文本文件并显示文本。现在,文本文件可以是英语,中文或任何语言。我的问题是,如何在不显示乱码的情况下正确显示角色。谢谢!

1 个答案:

答案 0 :(得分:0)

请参阅此链接。

How to display korean text on Textview?

您需要True Type字体(ttf)文件才能支持您希望的语言。将相应的字体文件包含在assets文件夹中并尝试使用此代码。

TextView text = (TextView) findViewById(R.id.textView1);
Typeface font=Typeface.createFromAsset(activity.getAssets(), "your-choice-font.ttf");
holder.text.setTypeface(font);
holder.text.setText(content_read_from_TxtFile);
相关问题