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

206 questions
18
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 …
18
votes
2 answers

Lollipop elevation on concave outline

I have a custom view which displays a star shape by using a path. This view works as expected, but now I want to shift it's implementation to the new Google Material recommendation. Unfortunately elevation depends on a convex outline, and I haven't…
17
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
  • 729
  • 1
  • 10
  • 31
16
votes
8 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,819
  • 4
  • 18
  • 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
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:…
Ava
  • 2,038
  • 3
  • 23
  • 45
15
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
  • 15,243
  • 9
  • 65
  • 95
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
2 answers

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
  • 828
  • 1
  • 9
  • 16
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,463
  • 3
  • 14
  • 23
13
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
  • 171
  • 1
  • 1
  • 6
11
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,347
  • 15
  • 24
10
votes
4 answers

Elevation on AppBarLayout doesn't work

When I try to set a specific value to elevation for AppBarLayout, the shadow disappears completely.
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,933
  • 7
  • 28
  • 47
10
votes
2 answers

How can I emulate button elevation (shadow) in Android API lower than 21?

I have this minimal Android Studio project with just a button. I assign the button a shadow with: android:elevation="3dp" android:translationZ="3dp" android:stateListAnimator="@null" and I see the shadow in Android Studio Design tab. But I also get…
Ramiro
  • 948
  • 2
  • 9
  • 22
1
2
3
13 14