You can show the touch ripple effect on Android ImageView easily. This is basically ImageView enabled the foreground especially for a hover effect, which also supports RippleDrawable from API21. You can also use this for masking an image with a frame image.
Use just android:foreground
attribute for a drawable to show over ImageView.
<com.genxhippies.library.RippleVisibleImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/newyork"
android:foreground="@drawable/touch_overlay"
android:clickable="true" />
You can use this with your code of course.
RippleVisibleImageView imageView = findViewById(R.id.image_view);
imageView.setForegroundResource(R.drawable.touch_overlay);
Project build.gradle
repositories {
maven {
url "https://jitpack.io"
}
}
Module build.gradle
dependencies {
compile 'com.github.inkyfox:RippleVisibleImageView:1.0.0'
}