0

When I click on the EditText, I want:

  1. the keyboard will not appear.
  2. cursor appear where I press.
  3. How can I have the location of the cursor in the code?

Things I tried but not worked:

  1. android:textIsSelectable="true" - don't show the keyboard neither the cursor.

  2. android:windowSoftInputMode="stateAlwaysHidden" - don't show the keyboard until I press on the edit text.

shizhen
  • 12,251
  • 9
  • 52
  • 88

1 Answers1

0

The question of how to stop and EditText from taking focus on Activity Startup has been asked and answered here: Stop EditText from gaining focus at Activity startup

EditText has a method called getSelectionStart() which will return the position of the cursor if there is no text selected. getSelectionEnd() will return the position of the end of selection.

Another link: For the EditText curson question: Get Cursor Position in Android in Edit Text? Hope that helps

Mikael Mengistu
  • 332
  • 1
  • 6