0
I went to use Elevation to test, but I inserted it in the XML of a button and did not change the elevation of it , if you can help me , thanks from now
0
I went to use Elevation to test, but I inserted it in the XML of a button and did not change the elevation of it , if you can help me , thanks from now
0
The attribute elevation
will only have any effect if you are using API level 21 or higher. Here are some tips on Elevation & Shadows.
According to the specifications of Material Design, each component has its ideal limit lifting, such as the Button
that has by default 8dp
.
In your case, what may be happening is that the default properties of the button is overwriting yours. If you set this elevation of 10dp
, for example to a LinearLayout
, will certainly work.
Take an example:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:background="#f0f0f0"
android:elevation="16sp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="80dp"
android:layout_height="80dp"
android:background="#ffffff"
android:layout_margin="20dp"
android:elevation="2dp"/>
</LinearLayout>
</RelativeLayout>
Imagery
Note: I strongly advise you to follow the recommendations of Material Design as to elevations and shading, so that it can continue with the same elegance.
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.
Where’s the code you’re using? Elevation on what? Toolbar? Relative? How to drill in better?
– viana
@If your questions have already been denied many times, I recommend reading http://answall.com/help/how-to-ask , if you continue to ask poorly reasoned questions, you may be punished as stated here http://answall.com/help/question-limited Just a hint, everyone is here to help... but to help you we need you to help everyone too!
– Daniel Gentil
Paiva, did you manage to solve the problem?! I even know how to do it, but I don’t know what you tried to do. Put here what you tried to do.
– viana
@Acklay <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test" android:Elevation="10dp"/>
– Paiva
I used a button and in his xml I put Elevation="10dp" but it does not change anything when testing on mobile
– Paiva