0

我将 EditText 设置为 textDirection - “Local”,并尝试使用阿拉伯语。当我开始输入时,它从我想要的右侧开始,但是当我输入“+”或“@”之类的字符时,它会将其添加到文本的开头并在输入另一个字符后将其移动到末尾。例如,当我输入 rao@gmail.com 时,在输入“@”和“。”时 字符被添加到文本的开头。

我在网上查看并阅读了有关使用“‎”的信息,但无法获得解决方案,您能否指导我如何解决它。

编辑文本

 <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/email"
            android:inputType="textEmailAddress"
            android:maxLines="1"
            android:lines="1"
            android:nextFocusDown="@+id/password_text"
            android:text=""
            android:textDirection="locale"
            />
4

1 回答 1

0

为了以最佳方式支持 RTL,您应该将其添加到清单中:

<application
    android:supportsRtl="true"
    ... >
        ...
 </application>

正如这里所说:https ://developer.android.com/guide/topics/manifest/application-element.html#supportsrtl

android:supportsRtl
声明您的应用程序是否愿意支持从右到左 (RTL) 布局。如果设置为 true 并且 targetSdkVersion 设置为 17 或更高,系统将激活和使用各种 RTL API,以便您的应用可以显示 RTL 布局。如果设置为 false 或 targetSdkVersion 设置为 16 或更低,则 RTL API 将被忽略或不起作用,并且无论与用户的区域设置相关联的布局方向如何,您的应用程序都将表现相同(您的布局将始终保留-向右)。

此属性的默认值为 false。

此属性是在 API 级别 17 中添加的。

于 2018-01-26T19:24:19.233 回答