我有当前的设置:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordiator_layout_in_main"
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.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.design.widget.NavigationView
android:layout_width="170dp"
android:layout_height="match_parent"
android:fitsSystemWindows="true"/>
<FrameLayout
// I place a fragment containing a viewpager containing fragments that contain a recyclerview....
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/nav_view">
</FrameLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/settings_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible">
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_refresh"
app:layout_anchor="@id/coordiator_layout_in_main"
app:layout_anchorGravity="bottom|right|end"
app:layout_behavior="com.material.widget.MyFloatingActionButtonBehavior" />
</android.support.design.widget.CoordinatorLayout>
现在如果我滚动包含片段的帧布局,工具栏会像我想要的那样滑入和滑出。现在的问题是,如果我滚动位于帧布局侧面(并且位于相对布局内部)的 NavView,我想禁用工具栏的滑入和滑出。
但是,无论我删除所有滚动行为,工具栏仍然会滑入和滑出(唯一禁用它的方法是从 appbarlayout 中删除滚动标志,但这会禁用 TolBar 的所有滑入和滑出)。
请问我错过了什么?难道滚动行为不应该将滚动事件传递到 CoordinatorLayout 吗?