嘿,
我的 txt 文件中有阿拉伯文本,我想在简单的 EditText 中显示它,
虽然当我这样做时我得到的是:http://i55.tinypic.com/66g09z.png http://i55.tinypic.com/66g09z.png
这是我用来从 .txt 文件获取文本的代码:
txt1 =(EditText) findViewById(R.id.EditText01);
try{
File f = new File(Environment.getExternalStorageDirectory()+"/1.txt");
FileInputStream fileIS = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
String readString = new String();
//just reading each line
while((readString = buf.readLine())!= null){
txt1.setText(txt1.getText().toString()+readString);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e){
e.printStackTrace();
}
}
如何将正确的阿拉伯字母输入到 EditText 中?
谢谢
您需要确保安装了带有阿拉伯字符的字体,并将 EditText 的字体设置为该字体。前者是令人烦恼的部分。 (我想我是通过告诉 SwiftKey 下载适当的语言模块来为我做到这一点的。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)