4

I would like to use a BottomAppBar with a FAB in center mode. i have 4 item to show and want to split like

this one

Is that possible ? if so : how ?

EDIT: I found the solution here : How to make Bottom AppBar like Google Home App?

  • Its simple just use **`app:fabAlignmentMode="center"`** in your `BottomAppBar` – AskNilesh Oct 30 '18 at 11:22
  • Please share code snippets with us what you have tried so far as well as the other research that you have done. Include what the result is as well. Before asking for the answer, it would be nice to see that you put some effort into it. – Valkyrie Oct 30 '18 at 11:23
  • I've tries to add "space/blank item" but that doesn't work properly. See screenshot here : http://prntscr.com/lc7sip – Louis Gautier Oct 30 '18 at 12:02
  • Post your xml for the bottombar as part of the question and we can have a look at it – Valkyrie Oct 31 '18 at 06:24
  • Hi. I found the solution here : https://stackoverflow.com/questions/52810905/how-to-make-bottom-appbar-like-google-home-app Just need fews changes for the ripple effect and here we go – Louis Gautier Oct 31 '18 at 10:19

1 Answers1

0

you need to add bottombar with fab as below in your xml

<com.google.android.material.bottomappbar.BottomAppBar
      android:id="@+id/bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      app:fabAlignmentMode="center"
      app:fabAttached="true"
      app:navigationIcon="@drawable/ic_menu_24"/>

  <com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_anchor="@id/bar"/>

also check this tutorial if you want to know how to setup your bottomappbar

karan
  • 8,637
  • 3
  • 41
  • 78
  • 3
    Sorry i made a mistake. I don't have problem to set the fab in center mode. The issue is how to set two icon on the left side and two icon on the right side – Louis Gautier Oct 30 '18 at 11:37