beerBear
beerBear

Reputation: 979

Introduce a View with a Floating Action Button Using Standard Components


I want to implement something like this but my current view already has a Floating Action Button on it so what I'd like to do is when the user clicks on any marker on the map then a this new View with the Floating Action Button will slide up from bottom of the screen moving the already existing Floating Action Button up while the view is sliding up to make space for itself.

How can I achieve this without using any 3rd party library and just using standard components? Thanks in advance.

Update: I am targeting api level 22; so using bottom sheets is out of scope. I recon that google maps app under api level 22 had bottom sheets kind of feature when one clicks on a POI marker.

Upvotes: 0

Views: 432

Answers (1)

Santhosh
Santhosh

Reputation: 3991

  1. You can use a bottom sheet to make the new view inside a coordinator layout.
  2. Reference the id of the view wich has set the BottomSheetBehavior with the layout_anchor attribute of the FAB. Example: app:layout_anchor="@id/app_bar"
  3. Configure the layout_anchorGravity attribute with the desired gravity. Example: app:layout_anchorGravity="bottom|end"

Look here for more

Upvotes: 2

Related Questions