我如何将光标定位在右侧的EditText [英] How do I position the cursor on the right in EditText

查看:513
本文介绍了我如何将光标定位在右侧的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.

当我使用安卓重力=正确的,光标OK(右侧),但随着用户开始输入文本始终移动到了另一边(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"
            />

ellipsize 重要

这解决您的问题。

这篇关于我如何将光标定位在右侧的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆