How to show arabic text in android?

喜你入骨 提交于 2019-12-22 18:33:13

问题


I want to show Arabic text from text file in android. in some phones and tablets it seems to be correct, but on some android devices it looks like the below text:

ا ل س ل ا م     ع ل ي ك م

Please help me how to show them correctly on every device.


回答1:


I assume that the problem here is that the text is not shown right-to-left. You should try using the Bidi class, or by specifying the following in your XML:

<EditText android:layout_width="match_parent" android:layout_height="wrap_content"android:id="@+id/editText1" android:gravity="right">/EditText>



回答2:


Copy the ttf file to the assets folder in your android project folder..Then set the typeface of the textview in the code.



来源:https://stackoverflow.com/questions/13720347/how-to-show-arabic-text-in-android

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