Onclick event on textview(that has TextIsSelectable=“true”) is ony called on second click

前端 未结 3 1260
情话喂你
情话喂你 2021-02-07 11:48

I have a onClickListener on a textview and the textview has the flag that it\'s selectable. But the onclick event I specified

3条回答
  •  悲&欢浪女
    2021-02-07 12:04

    I Just Used in TextView Xml :

    android: TextIsSelectable="true" 
    android: clickable="true"
    

    and worked fine for me. First Single Tap called the onclick event, And Anytime LongClick Select the text. And Double tap called the two method at a time. But, In my case this was no problem, this was worked for me for calling onclick and select the text as well at a time Without using a bunch of code.
    One bonus thing, It works fine also in adapter and recycler view as well.

提交回复
热议问题