Reputation: 2038
I have comment box using EditText and it has several lines. When user returns to the box they are always at end of line 1 rather than end of say line 3 if there are three lines total in the box. How can I fix this?
Upvotes: 3
Views: 7243
Reputation: 797
You can also do this
final int selectionStart = editText.getSelectionStart();
final int selectionend = editText.getText().length();
Selection.setSelection(editText.getText(), selectionStart, selectionend);
Please make you are not calling setText after this because that will override the behavior.
Upvotes: 0
Reputation: 40391
There might be easier ways perhaps, but one way is to use
editText.setSelection(editText.getText().length());
You can place this line inside an OnFocusChangeListener, or in a Create method.
Upvotes: 14