CorporateSlave CorporateSlave - 3 years ago 173
Android Question

FAB from github integration issues

Due to this issue> How to make FAB work in Fragment from a Activity and not in AppCompatActivity

I decided to use this resource >
https://github.com/Clans/FloatingActionButton

But when I put it in my layout 2 problems arose,
check image here


  1. Black background around the FAB

  2. Red line around the FAB circle.



How can I fix this?

FAB in xml

<com.github.clans.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="bottom|start"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:src="@drawable/smiley"
android:layout_margin="@dimen/fab_margin"
android:backgroundTint="@android:color/transparent"/>

Answer Source

Instead of using android:backgroundTint="@android:color/transparent" use fab:fab_colorNormal="@color/app_primary".

 <com.github.clans.fab.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:layout_marginBottom="8dp"
        android:layout_marginRight="8dp"
        android:src="@drawable/ic_menu"
        fab:fab_colorNormal="@color/app_primary"
        fab:fab_colorPressed="@color/app_primary_pressed"
        fab:fab_colorRipple="@color/app_ripple"/>

I hope it will help you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download