Search code examples
androidandroid-edittextonclicklistener

Working with EditText as with the TextView - onClickListener


I have EditTexts intstead of TextViews so I can select some text to share.

  android:textIsSelectable="true"
  android:editable="false"
  android:inputType="none"

But I have problem setting onClickListener on it. It barely works, you may tap it 10 times before Log show me result.I can do this :

 android:focusable="false"

and onClickListener works fine with this, but I can't select any text to share


Solution

  • If you just want the text to be selectable, simply use a TextView. They have the textIsSelectable attribute too and give a nicer UX (because the user thinks he can edit text in EditTexts, but he can't).