How to set the cursor to the right (EditText)?

怎甘沉沦 提交于 2019-11-28 13:31:35
Ersin Gülbahar

You can use like this:

if (your_edittext.getText().length() > 0 ) {
    your_edittext.setSelection(your_edittext.getText().length());
}

Can you add this line to your EditText xml

android:gravity="right"
android:ellipsize="end"
android:paddingLeft="10dp"//you set this as you need

But when any Text writing you should set the paddingleft to zero

you should use this on addTextChangedListener

Double.C

Set the android:Theme.Light style on the activity (theme) and android:gravity="right".

This works for me.

textview.setTextDirection(View.TEXT_DIRECTION_RTL);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!