roughike / BottomBar

(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
Apache License 2.0
8.41k stars 1.5k forks source link

FloatingActionButton and BottomBar #485

Open oradkovsky opened 8 years ago

oradkovsky commented 8 years ago

I've got BottomBar (shy) and FloatingActionButton, both bottom bound. BottomBar overlaps FloatingActionButton by default - anchoring is no help, only elevation, something like 8dp (but that's probably my custom context bound value). My post is either feature request or bug report - not sure about it: would it be possible to anchor FloatingActionButton top right of BottomBar, keeping "shy" behavior of latter one?( that is, when BottomBar hides down, move down FloatingActionButton thus in the end BottomBar is no longer showing, FloatingActionButton is showing normally)

ghost commented 8 years ago

had the same problem. But in my case it was a easy to solve it. Because now the BottomBar is a widget in the xml layout, that means that you have to specify a position in the layout. For example this is my layout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto">

<FrameLayout
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="60dp"/>

<com.roughike.bottombar.BottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_gravity="bottom"
    app:bb_tabXmlResource="@xml/bottombar_tabs" />

I was using a FrameLayout as a Parten container and one of the rules of a FrameLayout is that all the View in the container will overlap, so in my case i just gave a marginBottom to "@+id/fragment_container" of 60dp (The size of the BottomBar).

Hope it helps!