Check Mobile App
Read now
Start a Project

BottomAppBar with Floating action button in Android

Save

BottomAppBar with Floating action button in Android :

In this article, we are going to learn how to use the BottomAppBar with Floating action button in Android.

Bottom App Bar :

Android’s bottom app bar component APIs provide support for the navigation icon, action items, overflow menu, and more for informing the user as to what each action performs. While optional, their use is strongly encouraged.

Content descriptions

When using icons for navigation icons, action items, and other elements of bottom app bars, you should set a content description on them so that screen readers like TalkBack are able to announce their purpose or action, if any.

For an overall content description of the bottom app bar, set and android:contentDescription or use the setContentDescription method on the BottomAppBar.

For the navigation icon, this can be achieved via the app:navigationContentDescription attribute or setNavigationContentDescription method.

Bottom app bars provide access to a bottom navigation drawer and up to four actions, including the floating action button.

BottomAppBar can be included in your screen layout like so :

Note: Please make use that you are using the “Theme.MaterialComponents.DayNight.NoActionBar” in you app AppTheme like below. If you are not using the MaterialComponents theme then you can not use the BottomoAppBar.

styles.xml :

Anchoring a Floating Action Bar :

FloatingActionButton can be anchored to a BottomAppBar. We are using “layout_anchor” to attach the  FAB to the BottomAppBar. You just have pass the id at which you want to anchor your FAB.

In my case, I have chosen the default properties.  “cradled” within a cutout. This is the default behavior.

In order to implement this, the FAB also needs to be within the parent CoordinatorLayout :

Here we achieve the BottomAppBar with Floating action button in Android.

 

. . .

Leave a Comment

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


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

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

    Back to Home