Ripple effect over a RecyclerView item containing ImageView

后端 未结 6 1281
自闭症患者
自闭症患者 2020-12-12 22:09

I have a RecyclerView that expands the following grid item :



        
6条回答
  •  Happy的楠姐
    2020-12-12 22:56

    Your SquareImageView is filling up the entire space (width is match_parent and height is wrap_content) and so the SquareImageView receives the click event.

    What worked in my case was setting the clickable state of all objects in your RelativeLayout to false:

    android:clickable="false"
    

    Just make sure your RelativeLayout handles the click event in your activity. In my code I set the RelativeLayout to a view v and set an onClick Listener on it to handle the CheckBox within my List item.

    v.setOnClickListener(this);
    

    Hopefully this helps anyone who reads it.

提交回复
热议问题