Android: Why does long click also trigger a normal click?

前端 未结 4 1126
一整个雨季
一整个雨季 2020-12-01 00:40

I have a ListView with listeners for a long click and a regular click.

Why, when I long press a list item, the regular click event gets called too?

I need to

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 01:17

    Make sure you are overriding OnClickListener for your onClick method. Also make sure you are overriding OnLongClickListener for your onLongClick method. And make sure that your onLongClick method returns true, as this will consume the onClick.

提交回复
热议问题