Question:
There is a list of clickable CardView
built with a RecyclerView
and a custom Адаптера
with a standard implementation. ViewHolder
implements OnClickListener
. Missing element "touch" animation. Those. when clicking on any cardView
there is no response that the click actually happened, only one OnClickListener
.
How can I fasten the animation of the ripple
effect? There are probably ready-made implementations from Google itself, but for some reason I can’t find anything other than this . I tried to do it, the animation really appeared, but now the OnClickListener
method does not work 🙂 Or rather, it works, but only if you click on the edges of the cardview
(apparently where I have the layout_margin
defined and where the click animation does not reach). How can the problem be solved? Thank you
cardview.xml markup
<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/cardview_margin"
android:focusable="true"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<!-- тут много textView и LinearLayout -->
</android.support.v7.widget.CardView>
Answer:
Apparently, these are the features of Android development that you just need to know.
I removed android:clickable="true"
from the markup and everything worked as it should. Hope it helps someone in the future.