well android:editable="false"
is deprecated and doesn't work anymore and android:inputType="none"
would not give you the results you want
you could use
<EditText
android:cursorVisible="false"
android:focusableInTouchMode="false"
android:maxLength="10"/>
and if you want to make the EditText editable again you could do that with code
//enable view's focus event on touch mode
edittext.setFocusableInTouchMode(true);
//enable cursor is visible
edittext.setCursorVisible(true);
// You have to focus on the edit text to avoid having to click it twice
//request focus
edittext.requestFocus();
//show keypad is used to allow the user input text on the first click
InputMethodManager openKeyboard = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
openKeyboard.showSoftInput(edittext, InputMethodManager.SHOW_IMPLICIT);
Note I'm using android:focusableInTouchMode="false"
and not
android:focusable="false"
because when I use
edittext.setFocusable(true);
I still have to add
edittext.setFocusableInTouchMode(true);
Like this
edittext.setFocusableInTouchMode(true);
edittext.setFocusable(true);
for the edittext focus to be enabled again
inputType
and that may be overriding theandroid:editable="false"
setting. I may be wrong though. – Vaporizer