On Android Lollipop, I'm using:
android:background="?android:attr/selectableItemBackground"
to have the material animated feedback when I click on a button.
It works well when I have a button contained in a white/light layout, like a CardView for example.
But when I want to use the same thing on a dark background, we barely see the effect, it is not visible enough.
Does someone have an idea?
Thank you
Solution with AppCompat (works on old APIs too)
On API 21+ you can set
android:theme="@android:style/ThemeOverlay.Material.Dark"
on aView
orViewGroup
to change all of the theme attributes (text color, ripple color, button color, etc.) to the "dark" versions. If you set it on aViewGroup
, the theme is also applied to all of the child elements during inflation. It's an easy way to have regions of "dark" in an otherwise "light" interface (or vice versa).There is another way to change the app theme:
It works fine for me.