问题
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.
回答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