Detect click on RecyclerView outside of items

前端 未结 6 2623
醉话见心
醉话见心 2021-02-18 22:10

I have a RecyclerView with 2 items that don\'t fill the whole screen. How can I detect that the user clicked on the empty part of the RecyclerView (meaning clicked directly on t

6条回答
  •  半阙折子戏
    2021-02-18 23:05

    shortcutDeviceRecly.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
    
                    if(event.getAction() == MotionEvent.ACTION_UP){
                        roomClickEvent(true, v);
                    }
    
                    return false;
                }
            });
    

提交回复
热议问题