Skip to content

Instantly share code, notes, and snippets.

@Sefford
Created April 29, 2016 07:57
Show Gist options
  • Save Sefford/20a2a0d81301eb06aee5be50bc49afbb to your computer and use it in GitHub Desktop.
Save Sefford/20a2a0d81301eb06aee5be50bc49afbb to your computer and use it in GitHub Desktop.
<!-- For XML -->
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="@dimen/elevation_level_3">
<!-- Elevation is ignored in XMLs pre-Lollipop, but remember
that in those versions, to preserve Z-axis order in
layouts, Android handles it on a strict top-bottom
ordering (the lower, the higher) -->
// Code example
// Does nothing for pre-Lollipop and ViewCompat requires Android Support Library.
ViewCompat.setElevation(view, getResources().getDimensionPixelSize(R.dimen.elevation_dimen));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment