Android Setting with Textview for Hebrew Text

Android setting with TextView for Hebrew text?

Gravity will only affect alignment and will not set base direction for the text. That it works on some devices and not others may be a font issue, or perhaps an OS version issue. Try adding a RIGHT-TO-LEFT MARK character (\u200F) at the start of your text. This might help the display on an HTC and will not hurt anything on devices where it is already working.

android TextView doesn't show hebrew fonts

Hebrew in a TextView works well "right out of the box". Maybe there are issues with the BIDI, but generally it displays it good.

Regarding you second question, how can you set up a layout to be used when using hebrew, take a look at this:
RTL Languages support in android and resource qualifiers

Hebrew and normal text not displaying right

Sooo...
This finally worked for me....

textview.setTextDirection(View.TEXT_DIRECTION_LTR);

Please note that my problem was as I said, Im reading data from a database and not displaying strings, so this code forces all data to be read from left to right, if I do not use this line, It picks up the Hebrew characters as RTL text and wants to display the whole result as RTL.

Thanks for all the help though! I had a lot of reading and learned in the process!

TextView upside down in Android when set support RTL and Device in Hebrew Language

There are two options:
1.Change your layout to be RelativeLayout instead of LinearLayout and set the direction using "layout_leftOf" etc

Edit 1

Something like that:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:id="@+id/Net"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:gravity="end"
android:text="@string/Net"
android:textColor="@color/textPrimaryColor"
android:textDirection="rtl"
android:textSize="25sp"
android:textStyle="bold" />

<TextView
android:id="@+id/animText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:layout_toRightOf="@+id/Net"
android:gravity="end"
android:text="@string/C"
android:textColor="@color/animl"
android:textDirection="rtl"
android:textSize="30sp"
android:textStyle="bold"

/>

<TextView
android:id="@+id/lub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="3dp"
android:layout_toRightOf="@+id/animText"
android:gravity="end"
android:text="@string/Lub"
android:textColor="@color/textPrimaryColor"
android:textDirection="rtl"
android:textSize="25sp"
android:textStyle="bold" />

</RelativeLayout>

2.Change your layout order to be:

<TextView
android:layout_width="wrap_conten1t"
android:layout_height="wrap_content"
android:id="@+id/lub"
android:text="@string/Lub"
android:gravity="end"
android:textDirection="rtl"
android:layout_marginEnd="3dp"
android:textStyle="bold"
android:textColor="@color/textPrimaryColor"
android:textSize="25sp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/animText"
android:text="@string/C"
android:layout_marginEnd="2dp"
android:textDirection="rtl"
android:gravity="end"

android:textStyle="bold"
android:textColor="@color/animl"
android:textSize="30sp"

/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:layout_marginEnd="2dp"
android:textDirection="rtl"
android:text="@string/Net"
android:textStyle="bold"
android:textColor="@color/textPrimaryColor"
android:textSize="25sp"
android:id="@+id/Net"
/>


Related Topics



Leave a reply



Submit