LongClick event also triggers Click event

后端 未结 3 529
失恋的感觉
失恋的感觉 2021-02-13 10:03

I use onLongClick and onClick events of a button to get user inputs. Whenever; the user long click and triggers onLongClick event, the onClick event is also triggered. I couldn\

3条回答
  •  故里飘歌
    2021-02-13 10:52

    I'm not sure what order these events occur but the onLongClick handler returns a bool to indicate whether the event was handled. You should return true if you handled it so that other click events will not be called. I don't know if this will prevent prevent the onClick() from firing though.

    You may also turn these events off and on using setClickable(boolean) and setLongClickable(boolean)

    You can find this information and more about UI events here.

提交回复
热议问题