I have a ListView
with custom View
where I have a TextView
:
<TextView
android:id="@+id/textViewItemTitle"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="right|center_horizontal"
android:text="title" />
This TextView
contains Hebrew text.
if(!bidi.isRtl(event)){
event = bidi.unicodeWrap(event);
}
holder.title.setText(String.format("%s %s %s", bidi.unicodeWrap(item.getStartTimeNoDate().trim()), event,
bidi.unicodeWrap(item.getDuration().trim())));
Where the first argument is time hh:mm:ss, second (event) is a Hebrew String and third like the first.
The problem: some time the event String contains mixed text in Hebrew and English like abc-אבג
then all the text behave like the the gravity is left (and not right like I defined in the text view), I mean indented to left.
How to solve that?
Try adding to your TextView:
For more reading: http://developer.android.com/reference/android/view/View.html#attr_android:textDirection