Help me figure out these properties. The difference I understand is elevation is the base depth of the view, and translation z is a dynamic variable and is used for animation.

The question is, Google's guideline describes how the view-chi should be located on a plane following the concept of material design.

enter image description here

So, how do I compose these properties? If the button I set elevation = 2 and translationz = 8, will I get the right effect?

    1 answer 1

    The essence of both parameters is the same, changing the height by adding shadow, the only difference is that elevation is a static parameter, and translationZ is dynamic, so it can be used to create animations.

    In the usual layout, without animation, both parameters will have the same effect. And combining elevation="2dp" and translationZ="8dp" is the same as the "10dp" one of the parameters.

    To achieve the effect of the second picture, simply increase the value, for example, to "13dp" .

    • Got it, thank you! - Colibri