Ram*_*000 5 java android text textview
我的文字需要用拉丁语显示。当文本文件显示在TextView中时,其中带有问号的小菱形会出现在所有字母应带有重音的位置。有人可以帮忙吗?我需要能够以PDF格式显示文本。因此,我通过将文本的各个部分从PDF中复制到文本文件中来获取文本文件。扫描文本文件的代码如下所示:
public String inputStreamToString(InputStream is) throws IOException
{
StringBuffer sBuffer = new StringBuffer();
BufferedReader dataIO = new BufferedReader(new InputStreamReader (is));
String strLine = null;
while ((strLine = dataIO.readLine()) != null)
{
sBuffer.append(strLine + "\n");
}
dataIO.close();
is.close();
return sBuffer.toString();
}
Run Code Online (Sandbox Code Playgroud)
然后在onCreate()我有这个:
text = (TextView)findViewById(R.id.textView1);
//text.setText("This is a whole lot of text and praying");
InputStream iFile = getResources().openRawResource(idEng);
try {
text.setText(inputStreamToString(iFile));
text.setFocusable(false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
text.setMovementMethod(new ScrollingMovementMethod());
ELswitch = (ToggleButton)findViewById(R.id.toggleButton1);
ELswitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked==true)
{
InputStream iFile = getResources().openRawResource(idLat);
System.out.println(R.raw.sunday_compline_english);
try {
text.setText(inputStreamToString(iFile));
text.setFocusable(false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
InputStream iFile = getResources().openRawResource(idEng);
try {
text.setText(inputStreamToString(iFile));
text.setFocusable(false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
切换按钮使用户可以在英语和拉丁语之间来回切换。问题是拉丁语看起来像这样(所有带有重音符号的字母都替换为奇数的问号符号):

文本文件有问题吗?我应该直接使用PDF吗?如果有人有任何想法,我将非常感谢您的帮助。谢谢!
| 归档时间: |
|
| 查看次数: |
2413 次 |
| 最近记录: |