I have a main activity that have 3 views: toolbar
, MainContainer
& bottombar
toolbar
has a height of 60dpMainContainer
is match-parent bottombar
is 50dpThe problem with this, the bottombar
don't show at all, once the MainContainer
is set to match-parent
it fills the rest of the layout and pushing the bottombar
out of the visible area! same thing if the height is set to wrap-content
!! so how to solve this..!?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="@color/accent"/>
<FrameLayout
android:id="@+id/MainContainer"
android:layout_below="@id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"/>
<com.roughike.bottombar.BottomBar
android:id="@+id/bottombar"
android:background="@color/black"
android:layout_below="@id/MainContainer"
android:layout_width="match_parent"
android:layout_height="50dp"/>
</RelativeLayout>
You should use
android:layout_alignParentBottom="true"
If true, makes the bottom edge of this view match the bottom edge of the parent. Accommodates bottom margin.
Try With
<com.roughike.bottombar.BottomBar
android:id="@+id/bottombar"
android:background="@color/black"
android:layout_below="@id/MainContainer"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="50dp"/>
FYI
In your Framelayout
section add android:layout_marginBottom="50dp"