How can i write persian in android?

I am an amateur coder and I want to write Persian in android studio. But, having typed the Persian language, the android studio shows some strange characters. Of course, this was correct for about 3 months, but suddenly it is strange .: | I am grateful if you can help me fix this.

enter image description here

+6
source share
5 answers

In android studio 1.2 you have to go to settings> settings> colors and fonts> font> use your layout> uncheck only monospace fonts> and finally use the tahoma font and apply it well. Enjoy it!

Instruction manual

+2
source

In versions of android later than 3 you do not need anything, but in earlier versions you have to add Farsi.java to your application and write the text in the code as follows:

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

you cannot write farsi text in xml files in earlier versions !!! therefore, I suggest using newer versions of android.

0
source

select your project in android studio and go to File/Setting menu . in the page that opens, specify the File Encodings parameter and in this tab make sure that IDE Encoding is UTF-8

0
source

In Android Studio, go to settings → editor → font and colors → font, select the "secondary font" checkbox and define the Farsi font from the Nazanin list. Also uncheck "show only monospace font".

0
source

For Android Studio 1.5 on Windows, create a file called "idea.properties" in
C: \ Users \ .AndroidStudio1.5
and write this in the file:

 editor.new.rendering=true 
-1
source

Source: https://habr.com/ru/post/985984/


All Articles