Эффект ряби на весь родительский вид, нажав на элемент RecyclerView - PullRequest
0 голосов
/ 24 октября 2018

У меня есть CardView, который включает в себя RecyclerView внутри него.Я пытаюсь создать эффект ряби для всего CardView (или всего RecyclerView), когда пользователь нажимает на элемент RecyclerView, но эффект ряби применяется только к элементу.

    <android.support.v7.widget.CardView
                android:id="@+id/cardview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:foreground="?attr/selectableItemBackground">

                <android.support.constraint.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/list"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        app:layout_constraintBottom_toTopOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toBottomOf="parent"/>

                </android.support.constraint.ConstraintLayout>
            </android.support.v7.widget.CardView>

1 Ответ

0 голосов
/ 24 октября 2018

Добавьте следующие атрибуты к вашему CardView.

<android.support.v7.widget.CardView
    ...
    android:clickable="true"
    android:focusable="true"
    android:background="?android:selectableItemBackground"/>

Запустите ваше приложение.Это должно работать.

...