Issue
I'm trying to add elevation (shadow) to a com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
and it just doesn't apply
I've tried so far adding:
app:elevation="8dp"
app:borderWidth="0dp"
Even on different order as someone mentioned it may make a difference
Removed the android:background
and some other attributes just to see if it collides with the elevation but no luck.
The complete definition currently looks like this:
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/save_reminder_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:text="@string/save"
android:textAllCaps="true"
android:textColor="@color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingStart="15dp"
android:paddingLeft="15dp"
android:paddingRight="20dp"
android:paddingEnd="20dp"
app:elevation="8dp"
app:borderWidth="0dp"
app:icon="@drawable/ic_check_white_18dp"
app:backgroundTint="@color/colorPrimary"
app:layout_anchorGravity="bottom|end" />
Solution
The attribute to set the elevation is app:elevation
and the default value is 6dp
Use:
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
app:elevation="8dp"
Check your material components library and use the latest stable version (currently 1.2.0
).
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.