问题描述
我的应用程序使用 RTL 语言(从右到左).
My application uses RTL language (right to left).
当 EditText
字段获得焦点时,光标出现在左侧,只有当用户开始键入时,光标(和 RTL 文本)才会向右移动.当用户点击回车"开始换行时,光标再次向左移动.
When the EditText
field gets focus, the cursor appears on the left and only when the user starts to type, the cursor (and the RTL text) moves right.
When the user clicks "enter" to start a new line, the cursor moves to the left again.
当我使用 android:gravity="right"
时,光标正常(在右侧),但当用户开始键入时,文本总是移动到另一侧(RTL 文本移动左).
When I use android:gravity="right"
, the cursor is OK (on the right) but as the user starts to type the text always moves to the the other side (RTL text moves left).
任何想法如何将文本向右对齐并保持文本方向?
Any ideas how I can align text to the right AND keep the text direction?
推荐答案
它对我有用
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ellipsize="end"
android:gravity="right" />
椭圆尺寸
很重要
解决你的问题
这篇关于如何在EditText中将光标定位在右侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!