How do I position the cursor on the right in EditText(如何在EditText中将光标定位在右侧)
问题描述
我的应用程序使用 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中将光标定位在右侧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在EditText中将光标定位在右侧


- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01