BottomNavigationBar, Fab Button and ActionBar in a single layout

Viewed 1354

I want to have my MainActivity layout to be like thisenter image description here The top white bar is the NotificationBar. The grey color bar is ActionBar. The center white content is the place I want to place my fragments (upon selection using the Bottombar)

This is my layout file for the same. The Toolbar is hiding behind the notificationbar after installing the app on my device. What changes shall I do to make it work?

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

<android.support.v7.widget.Toolbar
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="top"
    android:foregroundGravity="top"
    android:layout_gravity="top"
    android:background="@color/colorPrimary"
    android:id="@+id/toolbar">

</android.support.v7.widget.Toolbar>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1">


    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/fragment_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        app:useCompatPadding="true"
        android:src="@drawable/ic_add_dark" />

</FrameLayout>

<com.roughike.bottombar.BottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:gravity="bottom"
    android:foregroundGravity="bottom"
    android:layout_gravity="bottom"
    app:bb_tabXmlResource="@xml/bottombar_tabs"
    app:bb_inActiveTabAlpha="0.6"
    app:bb_inActiveTabColor="#ffffff"
    app:bb_activeTabColor="#ffffff"
    app:bb_behavior="shifting|underNavbar"/>

2 Answers
Related