Stats

529 Contributors: 8 Thursday, January 5, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
Download eBook

FloatingActionButton

Download android eBook

Introduction

Floating action button is used for a special type of promoted action,it animates onto the screen as an expanding piece of material, by default. The icon within it may be animated,also FAB may move differently than other UI elements because of their relative importance. A floating action button represents the primary action in an application which can simply trigger an action or navigate somewhere.

Parameters

ParameterDetail
android.support.design:elevationElevation value for the FAB. May be a reference to another resource, in the form "@[+][package:]type/name" or a theme attribute in the form "?[package:]type/name".
android.support.design:fabSizeSize for the FAB.
android.support.design:rippleColorRipple color for the FAB.
android.support.design:useCompatPaddingEnable compat padding.

Remarks

Floating action buttons are used for a special type of promoted action. They are distinguished by a circled icon floating above the UI and have special motion behaviors related to morphing, launching, and the transferring anchor point.

Only one floating action button is recommended per screen to represent the most common action.

Before using the FloatingActionButton you must add the design support library dependency in the build.gradle file:

dependencies {
    compile 'com.android.support:design:25.1.0'
}

Official Documentation:

https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html

Material Design Specifications:

https://material.google.com/components/buttons-floating-action-button.html

Related Examples