Flutter floating action button with speed dial

Here’s a sketch of how to implement a Speed dial using FloatingActionButton. import ‘package:flutter/material.dart’; import ‘dart:math’ as math; void main() { runApp(new MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( home: new MyHomePage(), ); } } class MyHomePage extends StatefulWidget { @override State createState() => new MyHomePageState(); } … Read more

How to change android design support library FAB Button border color?

you can make circle without drawable <android.support.design.widget.FloatingActionButton android:id=”@+id/bottom_navigation_fab” style=”@style/fab_material” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentBottom=”true” android:layout_centerInParent=”true” android:layout_gravity=”bottom|center” app:borderWidth=”3dp” android:backgroundTint=”@color/mountain_meadow” // inner circle color android:layout_marginBottom=”10dp” android:tint=”@color/white” app:backgroundTint=”@color/white” // border color app:srcCompat=”@drawable/bottom_nav_star” /> output :

Bottom Align Floating Action Button

For RelativeLayout: <com.google.android.material.floatingactionbutton.FloatingActionButton android:id=”@+id/fab” android:layout_alignParentBottom=”true” android:layout_alignParentRight=”true” … /> For CoordinatorLayout, you should use android:layout_gravity=”end|bottom” For ConstraintLayout: <com.google.android.material.floatingactionbutton.FloatingActionButton android:id=”@+id/fab” app:layout_constraintBottom_toBottomOf=”parent” app:layout_constraintEnd_toEndOf=”parent” … /> See this answer for more information.

FloatingActionButton hide on list scroll

Those who are looking to make it with recyclerview can do this: recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy > 0 || dy < 0 && fab.isShown()) fab.hide(); } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { if (newState == RecyclerView.SCROLL_STATE_IDLE) fab.show(); super.onScrollStateChanged(recyclerView, newState); } });

FAB animation with viewpager/tabslider

First, you need to have the layout with the floating action button anchored to the ViewPager: <android.support.design.widget.CoordinatorLayout android:id=”@+id/main_content” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.design.widget.AppBarLayout android:id=”@+id/appbar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/action_bar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:layout_scrollFlags=”scroll|enterAlways” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light”/> <android.support.design.widget.TabLayout android:id=”@+id/tabs” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:background=”@android:color/white” app:tabGravity=”center” app:tabIndicatorColor=”?attr/colorAccent” app:tabMode=”scrollable” app:tabSelectedTextColor=”?attr/colorAccent” app:tabTextColor=”@android:color/black” /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id=”@+id/viewpager” android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_behavior=”@string/appbar_scrolling_view_behavior” /> <android.support.design.widget.FloatingActionButton android:id=”@+id/fab” app:layout_anchor=”@id/viewpager” app:layout_anchorGravity=”bottom|right|end” android:layout_width=”56dp” … Read more

FloatingActionButton with text instead of image

Thanks to all. Here is easy workaround which I found for this question. Works correctly for Android 4+, for Android 5+ is added specific parameter android:elevation to draw TextView over FloatingActionButton. <FrameLayout android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”bottom|right”> <android.support.design.widget.FloatingActionButton android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”https://stackoverflow.com/questions/33671196/@android:color/transparent” /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center” android:text=”@android:string/ok” android:elevation=”16dp” android:textColor=”@android:color/white” android:textAppearance=”?android:attr/textAppearanceMedium” /> </FrameLayout>