Android EditText: Disable edit but allow copy

Viewed 22

I have created an EditTextView in Android Studio. I would like to disable the possibilty to edit the pre-existing text while enabling the user to select and copy the text inside.

Before, it was possible to do it with:

android:editable="false"

Now however, this is deprecated and it doesn't work anymore. I tried to use:

android:inputType="none"

or

android:focusable="false"

This surely makes the text non-editable but there is no way for the user to select and copy it then.

Is there another way to do that ?

1 Answers

editText.setTextIsSelectable(true);

Related