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 appear,
- Black background around the FAB
- Redline 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"/>
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.