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
9
votes
1 answer

Android JNI crash when setting elevation / StateListAnimator for AppBarLayout

I'm trying to set the elevation of a AppBarLayout to 0 (and back to the default-value). It crashes some times (not always) and only on API 21 (>= 22 etc. working fine). I'm using a StateListAnimator as described in the link below (since it's the…
9
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
  • 788
  • 2
  • 8
  • 19
9
votes
4 answers

AppBarLayout elevation change is delayed on appCompat v24.0.0

In Appcompat v24.0.0 causes rendering of shadow/elevation to AppbarLayout after Activity is visible. And a lag can easily be seen in shadow drawing to AppbarLayout. And this lag was not there in previous Appcompat library version. Tested using both…
Vipul Asri
  • 7,856
  • 2
  • 41
  • 69
9
votes
2 answers

Android Ripple Effect + Elevation on non-Button Views

I am trying to add touch feedback to a LinearLayout that is similar to a regular Button's feedback in API level 21, much like in this example, and have been so far unsuccessful. I have defined a standard ripple drawable like this:
8
votes
3 answers

Android elevation and setElevation not the same effect

I noticed when I use elevation property in xml and set it to 4dp, I get a normal shadow. When I use setElevation(4) in java, I get less of a shadow than the xml property does. How can I fix that?
qwertz
  • 5,684
  • 9
  • 35
  • 60
8
votes
3 answers

What is elevation doing in Android L?

Today I developed my first Android L Apps, and read through the d.android.com/preview tips. They said that android:elevation would show me shadows. But look at this:
humbug
  • 333
  • 5
  • 11
7
votes
1 answer

In Android Elevation/Shadow is not showing when generating Bitmap of a View

I'm generating the bitmap of a view to show it as a marker on the Map. It is working fine but the issue that i'm facing is that elevation of the view is not showing. private Bitmap getMarkerBitmapFromView(View view) { …
7
votes
1 answer

Shadows created with Elevation flicker when changing Fragments in a ViewPager

I have a problem with shadows that are created with Elevation. My screen consists of a ViewPager with 4 different Fragments and a TabLayout for navigating. The first and last fragment both contain a RecyclerView which is filled with CardView…
Norik
  • 91
  • 1
  • 8
7
votes
1 answer

Elevation on Android 5.0 (Lollipop) not working

I've tried to reproduce Google's elevation example presented here: https://developer.android.com/training/material/shadows-clipping.html But for me no shadows are showing up. Not in the Android Studio designer, not on the AVD emulator. I'm using all…
Boris
  • 7,424
  • 21
  • 59
  • 105
7
votes
4 answers

android:elevation doesn't work in L preview

I've been playing with the L preview for a few days, and one thing that doesn't seem to work is the android:elevation attribute for a view. It works just fine when calling View.setElevation(), but it just seems to ignore the XML attribute. I'm using…
IvonLiu
  • 223
  • 1
  • 3
  • 9
6
votes
0 answers

Android not showing shadows on elevated view with SVG background

I have a View that I want to use an SVG/Vector as it's background. So it's not a perfect square, rounded, or any basic shape. I would like a drop shadow to surround the background, but it isn't working. I'll set the elevation, set the outline…
Jeff Hatfield
  • 101
  • 1
  • 8
6
votes
2 answers

Elevation shadow not visible for Toolbar with Basic Activity

I created a "Basic Activity" with Android Studio and attempted to create an elevation shadow on an API 28 Pixel device, using the answer from toolbar-not-showing-elevation-in-android-9-api-28. However, there is no elevation shadow displayed. The…
Steve M
  • 8,136
  • 8
  • 40
  • 84
6
votes
1 answer

Same elevation of views looks different for top and bottom views

Recently, I stunned with a problem. On my android phone elements of the list or scroll views with the same elevation have different shadows related to their positioning. For example, views on the top of the screen have a small light shadow, whenever…
Michael Spitsin
  • 2,424
  • 2
  • 15
  • 29
6
votes
4 answers

Android button elevation shadow not working

I am trying to make a button that has a shadow using elevation with a background image being my sign in with gmail png. The button is contained within a relative layout. The elevation won't show no matter what I try to do. I tried solutions from…
Jeffrey Chou
  • 271
  • 1
  • 4
  • 13
6
votes
2 answers

Android new fragment appears below old one during fragment animation

I'm using animation between my fragment : slide in from left :
Vodet
  • 1,235
  • 15
  • 32
1 2
3
13 14