Right to left characters canceled in Android emulator

First, I develop an application in RTL (Hebrew). I fought for two days with reverse characters.

My String XML:

<resources>
   <string name="app_name">SomeApp</string>

   <string name="hello_world">ΧžΧ” Χ”ΧžΧ¦Χ‘?</string>
   <string name="action_settings">Settings</string>
</resources>

With a string, hello_worldI want to create a textView that will use this string. The result should be:

? ΧžΧ” Χ”ΧžΧ¦Χ‘

However, the emulator shows:

emulator

As you can see, this not only changes the order of the sentence and the question mark. he also changes the order of the letters.

Things I've tried so far:

  • API level 20 and above. Some places implied that the problem was known in the version after version 4.2.
  • Use tags \u200Fat the beginning or end or in both sentences.
  • \u200e char, ", ,, ., ?, ! .. , .

activity_my.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"        android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MyActivity"
android:id="@+id/StudentLife">

<TextView android:text="@string/hello_world"             android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/textView"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

   </RelativeLayout>

, , , - .

+4
1

, Android Studio. ​​ , - .

, RTL Android 4.2 , . 2.3.3 .

, ? , \u200F, . 4.2 android:textDirection="rtl" .

+2

Source: https://habr.com/ru/post/1611657/


All Articles