【发布时间】:2015-10-14 17:49:45
【问题描述】:
这是我第一次用 RTL 语言(希伯来语)开发应用程序。这两天我一直在用颠倒的字符苦苦挣扎。
我的字符串 XML:
<resources>
<string name="app_name">SomeApp</string>
<string name="hello_world">מה המצב?</string>
<string name="action_settings">Settings</string>
</resources>
使用字符串hello_world,我想创建一个使用该字符串的textView。结果应该是:
?מההמצב
但是模拟器显示:
如您所见,它不仅改变了句子的顺序和问号。它还改变了字母的顺序。
到目前为止我尝试过的事情:
- API 级别 20 及以上。某些地方暗示该问题在 4.2 版本之后已修复。
- 在句子的开头或结尾或两者中使用标记
\u200F。 - 在每个特殊字符后使用
\u200e,例如"、,、.、?、!等。当我用希伯来语写字时,完全没有特殊字符,一切正常。李>
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>
我已经四处搜索,但没有任何效果,也许我错过了一些东西。
【问题讨论】:
-
截图显示的不是模拟器,而是Android Studio的可视化布局管理器。您是否在模拟器中启动了您的应用?
标签: java android-studio unicode android-emulator right-to-left