I am using a StaticLayout and using some RTL text.
The problem is that it's not handling RTL well. In TextView
you can set a "textDirection". is there any way to do it here too?
Thanks!
Asked
Active
Viewed 1,154 times
4
-
It doesn't work on all versions or just on old? – galvan Oct 19 '15 at 13:22
-
It doesn't work on all versions. – roiberg Oct 19 '15 at 13:40
-
@ssgr The proper tag replacement for 'rtl' is 'right-to-left'. Fixed it already :). – Paebbels Oct 19 '15 at 17:51
2 Answers
2
Try using the left-to-right mark in the string:
left-to-right mark: ‎ or ‎ (U+200E)
right-to-left mark: ‏ or ‏ (U+200F)
So in your string try usןמע in the following way
String rtl = "\u200F ימין לשמאל";

galvan
- 7,400
- 7
- 38
- 55
-
The text can be both RTL and LTR... So, should I add at runtime "\u200F"? It doesn't feel right. – roiberg Oct 19 '15 at 13:44
-
Have you tried yourTextCiew.setTextDirection(View.TEXT_DIRECTION_ANY_RTL); – galvan Oct 19 '15 at 13:49
-
1
-2
I had the same problem, it solved by changing
android:layout_width="wrap_content"
to
android:layout_width="match_parent"
in TextView tag.
I hope this help.

M.mirzaie
- 1
- 2
-
As you can see, I use, and have to use, a staticLayout. not a TextView. So it's not relevant. – roiberg Oct 24 '15 at 08:17