Android support design floating action button elevation not visible for colors other than white
Asked Answered
S

1

7

I'm using compile 'com.android.support:design:23.1.1' and android.support.design.widget.FloatingActionButton to create a FAB.

When the background tint color is white the elevation (shadow) is very visible.

enter image description here

But for other colors the elevation not visible.

enter image description here

Here is my code:

<android.support.design.widget.FloatingActionButton
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/create_floating_button"
        app:elevation="6dp"
        app:borderWidth="0dp"
        android:clickable="true"
        app:backgroundTint="@color/colorAccent"
        app:rippleColor="@color/colorAccentLight"
        android:layout_margin="10dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

Beside this problem, even with white color, the button doesn't seem like the ones in google material design spec.

Check this for example (the shadow's direction is down):

enter image description here

What am I doing wrong?

Sudra answered 19/2, 2016 at 12:39 Comment(0)
C
0

Make sure you have a specific layout-v21 file where you replace app:elevation with android:elevation. After API 21 you need to do this to maintain a good compatibility.

Catechol answered 12/6, 2017 at 13:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.