简体   繁体   English

如何在Android Studio中编写波斯语?

[英]How can I write Persian language in Android Studio?

I want to write Persian in Android Studio, but after typing Persian, Android Studio shows some strange characters. 我想在Android Studio中编写波斯语,但在输入波斯语后,Android Studio会显示一些奇怪的字符。 Of course it was right for about 3 months, but suddenly it's strange. 当然这是正确的约3个月,但突然间它很奇怪。

在此输入图像描述

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. 在android studio 1.2中你应该去配置>设置>颜色和字体>字体>使用你的方案>取消选中show only monospaced fonts>,最后使用tahoma字体并应用和确定。 Enjoy it! 好好享受!

Instruction 指令

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: 在3以后的Android版本中,您不需要任何东西,但在早期版本中,您必须将Farsi.java添加到您的应用程序并在代码中写入文本,如下所示:

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!!! 你不能在早期版本的xml文件中写波斯语文本! so I suggest to use newer versions of android. 所以我建议使用较新版本的android。

select your project in android studio and go to File/Setting menu . 在android studio中选择你的项目,然后转到File/Setting menu in the opened page point to File Encodings option and in that tabbed ensure IDE Encoding is UTF-8 在打开的页面中指向File Encodings选项,在该选项卡中确保IDE EncodingUTF-8

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". 在Android Studio中,转到设置 - >编辑器 - >字体和颜色 - >字体,选中“辅助字体”复选框,然后从列表中定义一个波斯语字体,如“Nazanin”。 Also, uncheck the "show only monospaced font". 此外,取消选中“仅显示等宽字体”。

For Android Studio 1.5 in Windows create file with name "idea.properties" in 对于Windows中的Android Studio 1.5,创建名为“idea.properties”的文件
C:\\Users\\.AndroidStudio1.5 C:\\用户\\ .AndroidStudio1.5
and write this in the file: 并在文件中写下:

editor.new.rendering=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM