设置光标移动到右侧的一个EditText与提示引力的中心 [英] Setting cursor to the right on an EditText with HINT Gravity to center

查看:561
本文介绍了设置光标移动到右侧的一个EditText与提示引力的中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能吗?任何属性的EditText这样做?

Is this possible? Any EditText attribute to do so?

感谢。

推荐答案

您可以使用

android:ellipsize="end"
android:gravity="center"

在你的XML时,你声明的EditText

in your xml when you declare the EditText

第一行是将光标移动到右侧,第二个到提示移到中央。 举个例子:

The first line is to move cursor to the right and the second one to move the hint to the center. An example:

<EditText
    android:id="@+id/txt1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="end"
    android:gravity="center"
    android:hint="@string/your_hint_id"
/>

这篇关于设置光标移动到右侧的一个EditText与提示引力的中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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