How can I write Persian language in Android Studio?

对着背影说爱祢 提交于 2020-05-26 12:10:06

问题


I want to write Persian in Android Studio, but after typing Persian, Android Studio shows some strange characters. Of course it was right for about 3 months, but suddenly it's strange.

enter image description here


回答1:


In android studio 1.2 you should go to configure> settings> colors and fonts> font> use your scheme> uncheck show only monospaced fonts> and finally use tahoma font and apply and ok. Enjoy it!

Instruction




回答2:


In android versions later than 3, you don't need anything but in earlier versions you must add Farsi.java to your app and in the code write text as follow:

MyTextView = (TextView) findViewById(R.id.MyTextView);

Typeface tf = Farsi.GetFarsiFont(this);
MyTextView.setTypeface(tf);
MyTextView.setText(Farsi.Convert("سلام"));

you cann't write farsi text in xml files in earlier versions!!! so I suggest to use newer versions of android.




回答3:


select your project in android studio and go to File/Setting menu. in the opened page point to File Encodings option and in that tabbed ensure IDE Encoding is UTF-8




回答4:


In Android Studio go to settings--> editor--> font and colors--> font, check the "secondary font" checkbox and define a Farsi font from the list like "Nazanin". Also, uncheck the "show only monospaced font".




回答5:


For Android Studio 1.5 in Windows create file with name "idea.properties" in
C:\Users\.AndroidStudio1.5
and write this in the file:

editor.new.rendering=true


来源:https://stackoverflow.com/questions/29875147/how-can-i-write-persian-language-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!