I know perfectly how to do this with relative layout or constraint layout. But I did not manage to do this with coordinator layout
It seems like the frame layout is overlapped with the top and bottom toolbars.
I need something like 'below' or 'above' tags from the relative layout. What is the right way to do this kind of layout with the coordinator?
I played with 'app:layout_anchorGravity' but I did not manage to get it right.
All I want to do is to show the fragment inside the frame layout without overlapping. I do not want my fragment to be overlapped from the toolbars, I want to be in between
As you can see from the image, the item number 0, and the item number 1 is not shown, it is behind the toolbar, also with the item number 21, 22 Thanks
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:id="@+id/appbar_bottom"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
android:id="@+id/bottombar_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/appbar_bottom"
app:layout_anchorGravity="top|end"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
Please check updated layout here... It should fixed your issue.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
android:background="@color/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/framelayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/appbar_bottom"
android:layout_below="@+id/app_bar" />
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:theme="@style/AppTheme.AppBarOverlay">
<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
android:id="@+id/bottombar_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:fitsSystemWindows="true" />
</android.support.design.widget.AppBarLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="top|end"
android:layout_margin="@dimen/fab_margin"
app:layout_anchor="@id/appbar_bottom"
app:layout_anchorGravity="top|end"
app:srcCompat="@android:drawable/ic_dialog_email" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>