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
304
votes
21 answers

Android "elevation" not showing a shadow

I have a ListView, and with each list item I want it to show a shadow beneath it. I am using Android Lollipop's new elevation feature to set a Z on the View that I want to cast a shadow, and am already doing this effectively with the ActionBar…
AggieDev
  • 4,604
  • 9
  • 24
  • 46
95
votes
6 answers

Setting Elevation in XML on AppCompat CardView on Android 5.0

From what I understand, early in the preview stage there seemed to be no way to set elevation in XML only on CardViews without a hack in Java. Now that the official release is out, is there any way of doing this in XML without writing Java code to…
57
votes
2 answers

Remove elevation shadow without removing elevation itself

Is there a way for AppBarLayout to no drop shadow and keep its elevation?
43
votes
7 answers

How to implement the Material-design Elevation for Pre-lollipop

Google has shown some nice ways that elevation effect are shown on Lollipop here. android:elevation="2dp" for buttons, android:stateListAnimator="@anim/button_state_list_animator" How can I mimic the elevation effect on pre-Lollipop versions…
38
votes
7 answers

Changing CardView shadow color

This question was asked on SO many times, but still I didn't find a good solution for this problem. Why do I need this to do? Well because project me and my team develops has iOS style. What did I try? 9.pathch shadow generator but 9.pathes are…
hotHead
  • 1,101
  • 3
  • 12
  • 28
38
votes
4 answers

"android:elevation=" doesn't work on devices pre-Lollipop with compile API21

I'm trying to use "android: elevation =" in my application but once I run it does not appear in the device with android 4.1.2 gradle apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion "21.1.2" …
Aspicas
  • 4,403
  • 4
  • 28
  • 51
37
votes
5 answers

Material TabLayout elevation not working

For some reason the elevation attribute does not seem to be working on the new TabLayout in the material design support library. Any ideas? XML:
dabluck
  • 1,571
  • 2
  • 12
  • 20
35
votes
1 answer

android:elevation only have shadow effects on the bottom side, how to make the shadow effects show on top side?

I use a framelayout at the bottom of an activity, in order to show the shadow effects on the fragment, I add android:elevation. But the shadow effects only appear in the bottom side not on top side, any one could give me some advice?
34
votes
3 answers

How to change direction of android elevation shadow?

I have FrameLayout with android:elevation="4dp". Shadow of this elevation directed down. I want change direction of shadow to up.
34
votes
8 answers

Elevation not working for ImageView

Elevation for ImageView is not working. I declared ImageView in XML like this:
Karthik
  • 341
  • 1
  • 3
  • 3
33
votes
1 answer

Difference between elevation and translationZ

I tried both features and I don't know really why I should use elevation instead of translationz or viceversa. Both generate shadow when I used them. I should use at same time (with the same value)? I should use just one? Thank you in…
JavierSegoviaCordoba
  • 5,841
  • 7
  • 32
  • 48
25
votes
3 answers

Android ScrollView clipping child elevation shadow

As the title states, I'm trying to put a CardView inside a ScrollView, but the CardView elevation shadow is being but off by it's parent... This is the Layout XML:
vicmns
  • 664
  • 1
  • 8
  • 19
19
votes
1 answer

Android appbarlayout elevation appears in status bar

How do I get rid of the elevation in the status bar? If I set in AppbarLayout the app:elevation to 0dp the elevation doesn't appear anymore in status bar but also not below the AppbarLayout. How do I just get the elevation under the…
Joestoen
  • 485
  • 1
  • 5
  • 14
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…
1
2 3
13 14