Marcel Adel
Marcel Adel

Reputation: 181

Display Arabic text in android 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?

Upvotes: 4

Views: 8877

Answers (2)

Houssin Boulla
Houssin Boulla

Reputation: 2869

1- You need update add: android:supportsRtl="true" on manifest on application tag

<application
...
android:supportsRtl="true"
...>

2- Add textDirection in your textView

android:textDirection="ltr" 

Upvotes: 0

Rami
Rami

Reputation: 7929

Use android:textDirection with "anyRtl".

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

  • From code: textview.setTextDirection(View.TEXT_DIRECTION_ANY_RTL);

PS: Since API 17+.

Upvotes: 13

Related Questions