Clans / FloatingActionButton

Android Floating Action Button based on Material Design specification
Apache License 2.0
5.22k stars 1.13k forks source link

Elevation working differently for FAB than for FAM #196

Open MatiasMinian opened 8 years ago

MatiasMinian commented 8 years ago

Hi, first of all thank you for this amazing library!

My problem is that I have a FAM and a FAB in the same position, and depending on which tab I am on I show one or the other. So far it works perfectly, but when I add elevation, they appear on slightly different positions, as shown in the following photos (in the photos I am showing both FAB and FAM to see the error):

Before elevation before elevation

After elevation after elevation

Rainer-Lang commented 8 years ago

For me it's working - FAB and FAM

MatiasMinian commented 8 years ago

I can't make it work. Before adding elevation both FAM and FAB are in the same place. Then I add elevation to the FAM and elevationCompat to the FAB and as I show in the picture the FAB moves a little bit its position. Shoud i do something else ? Can you tell me how you do it ? @Rainer-Lang
Thanks.

Rainer-Lang commented 8 years ago

Would be good to help you if you could show some Code.

MatiasMinian commented 8 years ago

This is the part of my xml where I add the FAB and the FAM, please let me know if you need anything else, thank you.

    <com.github.clans.fab.FloatingActionButton
         android:id="@+id/fab"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom|end"
         android:padding="@dimen/fab_padding"
         app:fab_elevationCompat="6dp"
         android:src="@drawable/ic_add_light"
         app:fab_colorNormal="@color/color_primary"
         app:fab_colorPressed="@color/color_primary_dark"
         app:fab_colorRipple="@color/color_primary_dark"/>

<com.github.clans.fab.FloatingActionMenu
    android:id="@+id/fam"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="bottom|end"
    android:elevation="6dp"
    android:padding="@dimen/fab_padding"
    app:menu_animationDelayPerItem="0"
    app:menu_backgroundColor="#BB8b8b8b"
    app:menu_colorNormal="#FFB805"
    app:menu_colorPressed="#F2AB00"
    app:menu_colorRipple="#D99200"
    app:menu_icon="@drawable/ic_new_note_light">

    <com.github.clans.fab.FloatingActionButton
        android:id="@+id/fab_option1"
        style="@style/MenuButtonsStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_written_note_light"
        app:fab_hideAnimation="@anim/fab_jump_to_down"
        app:fab_label="@string/note"
        app:fab_showAnimation="@anim/fab_jump_from_down"/>
</com.github.clans.fab.FloatingActionMenu>
Rainer-Lang commented 8 years ago

@MatiasMinian I have no elevation app:fab_elevationCompat="6dp". Tried without?