LongClick event also triggers Click event

后端 未结 3 518
失恋的感觉
失恋的感觉 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:47

    Solution On LongClick SingleClick will not work :

    rippleView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                //Your code
                }
            });
    rippleView.setOnLongClickListener(new View.OnLongClickListener() {
                @Override
                public boolean onLongClick(View v) {
                    return true;
                }
            });
    

提交回复
热议问题