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? I have a AutoCompleteTextView and a EditText with Text right align and an hint text. Now if one o
Solution 1:
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
Solution 2:
Set the android:Theme.Light
style on the activity (theme) and android:gravity="right"
.
Solution 3:
This works for me.
textview.setTextDirection(View.TEXT_DIRECTION_RTL);
Post a Comment for "How To Set The Cursor To The Right (edittext)?"