Is it possible to make RecyclerView not clickable? I want this because my RecyclerView only shows small icons in the CardView clickable . Therefore, if someone clicks the icons, he should just click (and animate) the parent CardView .
I tried the following:
recyclerView.setClickable(false);recyclerView.setFocusable(false);- Extend
RecyclerView and make onTouchEvent(MotionEvent) return false . - Use method 3 above and use
itemView.setClickable(false); in the RecyclerView adapter. This works, a click is sent to the parent element. However, now RecyclerView no longer scrolls. - Set
clickable="false" , focusable="false" , focusableInTouchMode="false" in the bloated XML list item. (See Comment by @Ibrahim) - Call
recyclerView#setLayoutFrozen(true) and itemView.setClickable(false); . This works, but has the same issue as # 4.
Any ideas on how to disable and pass the RecyclerView click events to the parent view? Note that the RecyclerView still needs to scroll (horizontally).
EDIT:
User @ c.dunlap suggested setting OnClick icons to icons and simply redirecting the click to the parent click. This will work, but there will be no click animation on the parent view. And if someone clicks on the itemView element, but still inside the RecyclerView (for example, ItemDecoration padding) - the click is not detected. Unfortunately, this is not a solution.
java android android-layout android-recyclerview
Thomas vos
source share