Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - difference between shadowElevation and shadowTranslationZ? #2

Open
firekesti opened this issue Apr 3, 2015 · 2 comments
Labels

Comments

@firekesti
Copy link

I've been playing around with the values in my app, and also looked at your source code, but I can't quite figure out what the difference is. I'm assuming shadowElevation is how "high" the shadow should be, e.g., what the elevation is of the material it's cast upon? While shadowTranslationZ is how "high" the item in the container is? I'm not sure – shadowElevation is not used in your sample!
Likewise for how much margin is required - you put 16dp for everything in the examples, but how can we calculate the minimum margin required for each shadow size?

Thank you so much for this library, I hope a short guide in the README would as helpful to others!

@h6ah4i
Copy link
Owner

h6ah4i commented Apr 4, 2015

Hi. The meaning of the words "elevation" and "translation" are the same with Android frameworks.

The Z value for a view has two components:

Elevation: The static component.
Translation: The dynamic component used for animations.
Z = elevation + translationZ

ref.) https://developer.android.com/training/material/shadows-clipping.html

Likewise for how much margin is required - you put 16dp for everything in the examples, but how can we calculate the minimum margin required for each shadow size?

Sorry, I am not sure that. Because the shadow's position and size are affected by the following factors.

  • Z position (elevation + translation)
  • X and Y position in the window (it depends on device screen size!)

@h6ah4i h6ah4i added the question label Apr 4, 2015
@firekesti
Copy link
Author

Thanks, this has helped 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants