你好。我正在编写一个示例应用程序来在 Android 中显示泰卢固语字体。我能够读取文件并在 android 中显示内容。但问题是我在泰卢固语中的发音是错误的。
谁能帮我比较一下泰卢固语字符的编码并纠正错误的发音。请在下面找到代码。
感谢你的帮助。
public class TeluguTestAppActivity extends Activity {
float textsize = 12;
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/*Incorporate font file to convert into Telugu fonts */
Typeface tf = Typeface.createFromAsset(getAssets(),
"fonts/DroidSansRegionalAAD.ttf");
tv = (TextView) findViewById(R.id.myFont);
tv.setTypeface(tf);
String st = readText();
tv.setText(st);
}
private String readText(){
StringBuffer sb = null;
BufferedReader bufReader = null;
/* Reading txt file which is placed in raw folder.
This contains telugu information. */
InputStream inputStream = getResources().openRawResource(R.raw.ad1);
try {
bufReader = new BufferedReader(new InputStreamReader(
inputStream, "UTF-8"));
sb = new StringBuffer();
String line = null;
while((line = bufReader.readLine()) != null){
sb.append(line + "\n");
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return sb.toString();
}
}