I have CoordinatorLayout , Toolbar , DrawerLayout and FrameLayout as the base layout of the Activity , but I am having problems with some overlapping Toolbar . I am inserting different Fragments into FrameLayout .
Action layout
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinator_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar android:theme="@style/ToolbarOverlay" android:popupTheme="@style/ToolbarOverlay" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:minHeight="?attr/actionBarSize" android:elevation="10dp"/> </android.support.design.widget.AppBarLayout> <FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="com.walintukai.lovelupdating.widgets.SnackbarBehavior"/> </android.support.design.widget.CoordinatorLayout> <ListView android:id="@+id/navigation_drawer" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="#80858585" android:dividerHeight="1dp" android:listSelector="@android:color/transparent" android:background="#bf333333"/> </android.support.v4.widget.DrawerLayout>
When I ran this, my Toolbar overlaps the contents of the FrameLayout and is on top of it when I want it to be below it, like LinearLayout.
How to configure it so that the contents of FrameLayout below the Toolbar and do not overlap them?
Update 1:
I tested using app:layout_behavior="@string/appbar_scrolling_view_behavior" as a behavior for FrameLayout , and it gives me the expected behavior for Toolbar , but then it removes the Snackbar push behavior. How to combine two behaviors together?
I tried to extend the ScrollingViewBehavior and combine the two behaviors, but when Snackbar shows that it once again pushes the layout under the toolbar. If I let go of Snackbar, everything will be fine.
source share