Floating action button

Floating action button (FAB) is simply a circle button with rounded shadow, floats above the UI and used to display any promoted action.

Floating action button can be an either of two sizes :

  1. normal (56dp)
  2. mini (40dp)

To use Floating action button you need to do following steps :

1. Add design support library in gradle file.

compile 'com.android.support:design:22.2.0'

2. Include FloatingActionButton in xml layout. you need to include xmlns:app=”http://schemas.android.com/apk/res-auto as namespace the top of your layout.

3. Write your code in JAVA file.

4. Output

fabloli

Lolipop FloatingActionButton

fabkit

Kitkat FloatingActionButton

Floating Action Button Between Two Layouts

You need to take parent layout as CoordinatorLayout.

in your xml :

Output : 

device-2015-10-22-165340

Follow me

Ravi Rupareliya

He is author of Android Gig. He loves to explore new technologies and have worked on Android, React Native, Action on Google and Flutter.
Ravi Rupareliya
Follow me

Latest posts by Ravi Rupareliya (see all)

Snackbar, Bye Bye Toast! Taking Oxycodone