RecyclerView에서 리플 효과를 구현하려고했습니다. 여기 내 레이아웃입니다 :가벼운 탭에서 RecyclerView에 대한 리플 효과가 작동하지 않습니다.
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card"
android:layout_marginTop="7dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="5dp"
android:clickable="true"
card_view:cardElevation="5dp"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<TextView
//some properties />
<TextView
//some properties />
<TextView
//some properties />
</LinearLayout>
</android.support.v7.widget.CardView>
기본적으로 내가 여기에이 튜토리얼 다음에 온 클릭 리스너 구현하려면 : http://sapandiwakar.in/recycler-view-item-click-handler/
문제가를 그 파급 효과, 라인에 생성 된 감사 :
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
은 가벼운 (즉 빠른 것) 프레스에서 작동하지 않습니다. 화면을 빠르게 탭하면 클릭 리스너가 트리거됩니다. 터치 이벤트가 감지되었지만 파급 효과가 나타나지 않았 음을 의미합니다. 잔물결 효과를보고 싶다면 공개하기 전에 화면의 압력을 조금 더 오래 유지해야합니다.
이 동작을 수정하고 빠른 누르기에도 리플 효과를 표시하는 방법이 있습니까?
'selectableItemBackgroundBorderless'를 사용하십시오. Marshmallow는'selectableItemBackground'의 동작을 변경하여 더 긴 탭에 대해서만 리플을 보여줄 것이라고 생각합니다. –