2

I used supprtLibrary to add ripple on an imageView.

I saw a post where they set the ripple effect using background attribute and another where they set the foreground attribute.

android:background="?attr/selectableItemBackground"

android:foreground="?attr/selectableItemBackground"

Both ways are ok? same effect?

Elad Benda
  • 35,076
  • 87
  • 265
  • 471
  • `android:foreground` will work only in API 23 and above. If you want simple grey ripple just use `android:background`. If you need to have not default background and ripple effect above it then use both of them. – tymbark May 29 '19 at 13:18
  • Thanks, how could i have found this difference btw? have a documentation link please? – Elad Benda May 29 '19 at 14:07
  • `android:foreground` - https://developer.android.com/reference/android/view/View.html#attr_android:foreground `android:background` - https://developer.android.com/reference/android/view/View.html#attr_android:background – tymbark May 30 '19 at 11:41

0 Answers0