2

I have set EditText in xml file as android:gravity="top" and android:inputType="textMultiLine" with some text data.

The issue now here is that the Cursor is always shown at the end of the first line, whereas i want it to be at the start of the first line.

How to do this?

SOLUTION:

editText.requestFocus(); 
editText.setSelection(0); 
1
  • editText.setSelection(editText.getText().length()-1); Commented Feb 29, 2012 at 13:53

1 Answer 1

6

Use EditText.setSelection(int index)

1
  • 2
    done myself. This works You need to set editText.requestFocus(); editText.setSelection(0); Commented Feb 29, 2012 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.