Случай 1, эффекты показывают за изображением:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:src="@mipmap/desire_image" />
или овальные эффекты, но они все еще показывают за изображением
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless"
android:src="@mipmap/desire_image" />
Случай 2, используя вид карты, оберните изображение и вид плашхолдера и установите щелчок на виде плахолдера. Эффекты покажут перед изображением:
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
app:cardCornerRadius="4dp"
android:layout_height="wrap_content">
<!-- Expect image view, image button, button-->
<ImageView
android:layout_width="desire_size"
android:layout_height="desire_size"
android:src="@mipmap/desire_image" />
<View
android:id="@+id/clickable_view"
android:layout_width="desire_size"
android:layout_height="desire_size"
android:background="?selectableItemBackground"/>
</androidx.cardview.widget.CardView>
примечание: зарегистрируйте событие onClick, чтобы показать эффекты