禁用 android CoordinatorLayout 滚动行为
Disabling android CoordinatorLayout scrolling behaviour
将滚动行为添加到具有coordinatorLayout的布局时,如下所示:
<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:fitsSystemWindows="true">
<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="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
mainContent 是重要的部分。
真正的布局将在这个容器内膨胀。
假设我的 View
由 RecyclerView
和屏幕底部的固定布局组成。
有人知道如何去除底部固定布局的滚动行为并保持RecyclerView
-Toolbar
-隐藏行为吗?
在 'CoordinatorLayout' 内,滚动的视图必须先于不可滚动的视图。我设法通过将我的不可滚动布局放在 'mainContent' 之外,就在它下面
来解决这个问题
将滚动行为添加到具有coordinatorLayout的布局时,如下所示:
<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:fitsSystemWindows="true">
<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="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
</FrameLayout>
</android.support.design.widget.CoordinatorLayout>
mainContent 是重要的部分。
真正的布局将在这个容器内膨胀。
假设我的 View
由 RecyclerView
和屏幕底部的固定布局组成。
有人知道如何去除底部固定布局的滚动行为并保持RecyclerView
-Toolbar
-隐藏行为吗?
在 'CoordinatorLayout' 内,滚动的视图必须先于不可滚动的视图。我设法通过将我的不可滚动布局放在 'mainContent' 之外,就在它下面
来解决这个问题