Questions tagged [android-elevation]

Android elevation is a feature introduced in Android Lollipop 5.0, is part of new Google Material Design Recommendation. Also involves translationZ property.

Android elevation is a feature introduced in Android Lollipop 5.0, is part of new Google Material Design Recommendation. Also involves translationZ feature.

Material design introduces elevation for UI elements. Elevation helps users understand the relative importance of each element and focus their attention to the task at hand.

Assign Elevation to Your Views

197 questions
17
votes
1 answer

Clarification regarding Android "Attribute elevation is only used in API level 21 and higher"

I'm a newcomer to developing for Android, and the concept of developing across multiple different platforms with different supported features on each is really making my head hurt. For example, if I go into an xml file and set …
16
votes
5 answers

Android - CardView elevation shadow make darker

I am using 'com.android.support:cardview-v7:23.4.0' and I see the shadow but is not a dark grey shadow, and I would like to get a darker elevation shadow, but I do not see any attribute to get it, any ideas?
Billyjoker
  • 701
  • 1
  • 10
  • 27
16
votes
1 answer

Change Elevation of ActionBar by theme

I want to remove the shadow below the ActionBar. I know that I need to change the elevation to 0dp, but I want to do it in the theme. For Android 4.4- I use : @null But is it possible for Android 5.0…
15
votes
7 answers

How to add bottom shadow to tab layout or Toolbar in android

Hi i need add shadow under my tab layout (like in skype). My activity xml:
puko
  • 2,156
  • 3
  • 13
  • 23
15
votes
0 answers

"setElevation" vs "setTranslationZ" vs "setZ"

Lollipop has all those new functions for the "View" class. What exactly are the differences between them, and why do we need so many functions for them? I've read the docs, and I want to understand (or better understand) the difference and the need…
android developer
  • 106,412
  • 122
  • 641
  • 1,128
15
votes
2 answers

How to show the shadow of the ActionBar&Toolbar of the support library on all Android versions?

This is a simple question: I use the new support library, which allows me to have a Toolbar instance and even set it as the actionBar of the activity (or use the default one). How do I customize the shadow being cast by the Toolbar (or the default…
14
votes
1 answer

React-native component's "elevation" style is causing ugly shadows

The elevation style attribute enables box-shadows for Android 5.0+. Am I doing something unusual with 'elevation' here to cause the ugliness that can be seen in the screenshot below? Also, is there any way to define a shadow-offset? The emulator is…
Squeaky
  • 808
  • 1
  • 9
  • 15
14
votes
1 answer

Two views with same elevation side-by-side

I have two views with the same elevation beside each other. My wanted behaviour is that they won't cast a shadow over each other as they have the same elevation, however, what is happening is that the view on the left, casts a shadow on the right.…
Daniel Julio
  • 1,413
  • 2
  • 14
  • 23
13
votes
1 answer

Android “elevation” is not showing a shadow under a CustomView

I Have a CustomView working on pre-Lollipop, now I tried to apply android:elevation and android:translateZ on Lollipop devices but doesn't seems to work.
rnrneverdies
  • 13,347
  • 9
  • 57
  • 89
12
votes
2 answers

View with elevation and shadow in ConstraintLayout

How can I show elevations in a view with shadows using ConstraintLayout? With Relative and Linear could perform elevations with shadows to implement list but I can not do it with ConstraintLayout.
PepitoGrillo
  • 151
  • 1
  • 1
  • 6
12
votes
1 answer

Draw elevation shadows to canvas

I use the code below to draw a view on to a bitmap/canvas. Bitmap bitmap = Bitmap.createBitmap( viewGroup.getWidth (), viewGroup.getHeight (), Bitmap.Config.ARGB_8888); viewGroup.draw(new Canvas(bitmap)); It works great, with one small problem:…
RedHatter
  • 1,529
  • 2
  • 19
  • 39
10
votes
2 answers

Elevation animation on click on CardView

I want to add the elevation animation to my android.support.v7.widget.CardView, just like the material style Buttons do. I've tried to set a StateListAnimator: android:stateListAnimator="@anim/selector_raise" which points to my selector in…
manfcas
  • 1,855
  • 6
  • 28
  • 46
10
votes
1 answer

How to add elevation to transparent ImageView [android]

Is it really to implement elevation of ImageView with png that contains transparent background? For example: i want to add elevation shadow to this pic: Want make it like this:
Rahim Rahimov
  • 1,227
  • 14
  • 24
10
votes
1 answer

How would I get a ListView Item to be elevated?

I am trying to get it so my listview items are elevated and show a drop shadow. Here is my list view item layout
Errol Green
  • 1,297
  • 5
  • 17
  • 29
9
votes
2 answers

Elevation on AppBarLayout doesn't work

When I try to set a specific value to elevation for AppBarLayout, the shadow disappears completely.
1
2
3
13 14