Easy fix
Your problem with the loss of touch feedback and Z animation when updating the style comes from a non-extension of the parent Android: Widget.Material.Button in your style. If you do this, you won’t have to do manual animation or touch feedback. Just rewrite what you need!
Description of Depth Z
According to the documentation, TranslationZ is just a dynamic component of the Z value. This means that when animating your representations along the Z axis (using ViewPropertyAnimator , etc.), the animation state will trigger Z, elevation values from the static component, and will end when full value of Z using the translation component, which is the change between them or delta.
Z = height + translation Z
To implement the animation with the StateListAnimator translation, you need to make a StateListAnimator . In your particular case, because you aren’t animating anything, to set the Z-depth to Button , you just need elevation .
source share