How to set a ripple effect on textview or imageview on Android?
Ref : http://developer.android.com/training/material/animations.html,
http://wiki.workassis.com/category/android/android-xml/
<TextView
.
.
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
/>
<ImageView
.
.
.
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
/>
Native Round Ripple Effect For ImageView
You should use
android:background="?attr/selectableItemBackgroundBorderless"
Ripple effect over imageview
Add android:background="@null"
for the ImageView
onRecieve show a single ripple effect on imageView
Call stopRippleAnimation after the ripple animation duration.
Also you can easily perform this animation using valueAnimator, Fadeout and scale using the values between 0 and 1.
Ripple effect is not going above the ImageView
Few days back I was also facing same issue. I solved my issue by wrapping ImageView
inside FrameLayout
and applying android:foreground
property on FrameLayout. You also have to set android:clickable
property of FrameLayout
to true
or should set onClickListener
to FrameLayout
.
Please check my answer in following thread in following link.
Let me know if it helps.
Related Topics
How to Add Firebase-Admin to My Android Project
Change Chip Widget Style Programmatically Not Working - Android
Fragment View in Viewpager Is Not Restored When Resuming
JSONarray Cannot Be Converted to JSONobject Error
How to Get Raw Preview Data from Camera Object at Least 15 Frames Per Second in Android
How to Hide App Title in Android
Play-Services-Ads Conflicts with Appcompat
Get Font Scaling Factor to Calculate the Fontsize
How to Get Screen Display Metrics in Application Class
How to Access Files Under Assets Folder of Other APK'S
How to Integrate Samsung Gear Steps in Android Application
Not Enough Space to Show Ad (Admob)
Android - Expandable Textview with Animation
How to Configure Gmail in Android Emulator
How to Add a Button at The End of Recyclerview