how to use it in xml?
How use it in activity_main.xml file rather than in MainActivity.java?
I found it a bit awkward to use it directly by xml, as you would have to use a FrameLayout with two children (your main content and BottomBar with android:layout_gravity="bottom" set) to get started.
But I'll look into this.
Another problem with inflating it from XML is that on tablets it won't behave properly. It should look like this but the BottomBar has no way to not overlap your content.
So here's what I found about the XML issue:
- A bit awkward to use it directly by xml, as you would have to use a RelativeLayout with two children, your main content with
android:layout_above="@+id/bottomBar"and BottomBar withandroid:layout_alignParentBottom="true"set to get started. - Even after that it won't behave properly on tablets without extra configuration from the user (an extra layout in layout-sw600dp folder). It should look like this but the BottomBar has no way to not overlap content.
But you can add the BottomBar practically anywhere to your layout by using bottomBar.attach(findViewById(R.id.myView), savedInstanceState). This will let you control what View the BottomBar should contain. Basically with this you can put it anywhere in the View hierarchy.
Using the BottomBar should be as simple as possible and same code should work by default for both tablets and phones solution.
For these reasons, I'm closing this issue.