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中将光标定位在右侧
基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
