在Android TextView中显示阿拉伯文字 [英] Display Arabic text in android textview

查看:426
本文介绍了在Android TextView中显示阿拉伯文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发android应用,其中将html文件保存在资产文件夹中,这些文件包含阿拉伯文字,例如قُلِ اللَّهُمَّ مَالِكَ الْمُلْكِ تُؤْتِي الْمُلْكَ مَنْ تَشَاءُ وَتَنْزِعُ الْمُلْكَ مِمَّنْ تَشَاءُ我想设置textView白色,但我尝试了波斯语类,但它没有不能正确显示. 有任何想法吗?

I'm trying to develop android app where I have html files saved in asset folders, these files contain Arabic text like this قُلِ اللَّهُمَّ مَالِكَ الْمُلْكِ تُؤْتِي الْمُلْكَ مَنْ تَشَاءُ وَتَنْزِعُ الْمُلْكَ مِمَّنْ تَشَاءُ I want to set textView whit this text I tried Farsi class but it doesn't show it properly. Any ideas?

推荐答案

使用 anyRtl "的android:textDirection .

Use android:textDirection with "anyRtl".

  • 在xml中:在TextView标记中添加以下行:android:textDirection="anyRtl".

  • From xml: Add this line: android:textDirection="anyRtl" to your TextView tag.

来自代码:textview.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);

PS:自API 17+开始.

PS: Since API 17+.

这篇关于在Android TextView中显示阿拉伯文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆