I got good answers from i.shadrin ( here ) and Nicolars ( here ).
The difference between their answers is that ?attr/selectableItemBackgroundBorderless can give you android.view.InflateException , so the solution ?android:attr/selectableItemBackground is the solution.
FWIW, I donβt know why the exception occurs because the first answer worked perfectly in all my old projects, but not in my recent project (maybe because of the application theme = android:Theme.Material ?).
The strange thing that was happening is that although the ripple effect was shown, it did not limit ImageButton, so the solution:
- To use
android:foreground="?android:attr/selectableItemBackgroundBorderless" instead of android:background="?android:attr/selectableItemBackgroundBorderless"
Hope it helps you if you come across the same.
Filipe de Lima Brito Nov 09 '17 at 20:01 2017-11-09 20:01
source share