【问题标题】:Textview properly displaying encoded textTextview 正确显示编码文本
【发布时间】:2012-09-18 00:06:17
【问题描述】:

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

【问题讨论】:

    标签: android encoding character-encoding


    【解决方案1】:

    参考这个链接。

    How to display korean text on Textview?

    您需要 True Type 字体(ttf) 文件来支持您想要的语言。将相应的字体文件包含到您的资产文件夹中并尝试此代码。

    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);
    

    【讨论】:

      猜你喜欢
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多