如何设置光标移动到右侧(EditText上)? [英] How to set the cursor to the right (EditText)?
问题描述
如何设置光标右对齐和提示文字的权利?
是否有可能?_爱
How to set the cursor to the right with right align and hint text?
Is it possible?
我有一个AutoCompleteTextView和文字的EditText右对齐和提示文本。 现在,如果他们中的一个聚焦在光标是hint之前,而不是在该行的末端。 所以它看起来像现在它的坏...
I have a AutoCompleteTextView and a EditText with Text right align and an hint text. Now if one of them is focused the curser is before the hint and not at the end of the line. So it looks like now it's bad...
我也试着设置光标的位置,但它并没有帮助的课程。
I've also tried to set the cursor position, but it didn't help of course.
<AutoCompleteTextView
android:id="@+id/input_snm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/input_ipAdresse"
android:ems="10"
android:gravity="right"
android:hint="@string/input_snm"
android:imeActionLabel="@string/Button_berechnen"
android:imeOptions="actionDone|flagNoExtractUi"
android:inputType="phone"
android:paddingRight="@dimen/padding_small"
android:textSize="@dimen/fontsize_medium" />
图片:EditText上
好吧,我认为这是一个系统错误,不是吗?
Image: EditText
Ok, I think it's an System error, isn't it?
推荐答案
您可以使用这样的:
If(your_edittext.gettext(). Length() >0)your_edittext.setSelection(your_edittext.getText().length());
您可以将此行添加到您的EditText XML
Can you add this line to your edittext xml
安卓重力=正确的
安卓ellipsize =结束
安卓以下属性来=10dp//设置成你需要的
但是,当所有文字写作,你应该设置以下属性来零
But when any Text writing you should Set the paddingleft to zero
您应该使用在 addTextChangedListener
这篇关于如何设置光标移动到右侧(EditText上)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!