I am trying to settext in an EditText...But after setText is done, the cursor remains at the start of text.how can i move it to the end of the text?
Any help in this regard is appreciated.
Best Regards, Rony
Say in your xml's edittext section, add android:paddingLeft="100dp" This will move your start position of cursor 100dp right from left end. Same way, you can use android:paddingRight="100dp" This will move your end position of cursor 100dp left from right end.
EditText is used for user input. TextView is used to display text and is not editable by the user. TextView can be updated programatically at any time.
EditText inputField;
Editable etext = inputField.getText();
int position = etext.length();
inputField.setSelection(position);
Use append(CharSequence text)
. This will also update the position of the cursor. See Android Documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With