How to handle multiple layout clicks in recyclerView in Android

前端 未结 5 1735

In our app we have list of messages. We are switching to RecyclerView. Our messages can consist from texts, images. Sample message can look like this.

5条回答
  •  感动是毒
    2021-01-02 10:45

    You may try this code :

    GestureDetector detector;
    

    then:

    detector = new GestureDetector(MainActivity.this, MainActivity.this);
    
        avatar.setOnTouchListener(new OnTouchListener() {
            public boolean onTouch(View view, MotionEvent e) {
                detector.onTouchEvent(e);
                return false;
            }
        });
    

提交回复
热议问题