How to add Extended Floating Action Button in Android App

Updated 24 January 2024


An Extended Floating Action Button displays the primary action in an application.

The Extended FAB is wider than the regular FloadtingActionButton, and it includes a text label.

Extended floating action buttons adjust their position and visibility in response to other UI elements on the screen.

The ExtendedFloatingActionButton widget provides a complete implementation of Material Design’s extended FAB component

Note: ExtendedFloatingActionButton is a child class of Material Button, rather than FloatingActionButton. This means that several attributes which are applicable to FloatingActionButton have different naming in ExtendedFloatingActionButton.

You just need to follow few steps to add ExtendedFloatingActionButton in your app ->

Compile your app with Android P

In order to use Material Components for Android, and the latest versions of the Support Libraries, you will have to update your app’s complieSdkVersion to 28

Dependency –

You also need to migrate your project with AndroidX.

For AndroidX migration, you can refer this link -> AndroidX

In XML –

In Style File –

You need to change your app theme to inherit from a Material Components theme.

Note: You can use any child of “Theme.MaterialComponents” as a parent theme of your application.

Now, if you want to expand or shrink your button at any point, you need to call only two methods ->

  1. shrink() -> to shrink your fab button
  2. extend() -> to extend your fab button

To learn more about material extend floating action button, you can refer this link – Material Extended Floating Action Button

Hope, this blog is helpful for you to add Extended Floating Action Button in android app.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home