当使用 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”中,滚动的 View 必须首先出现,并且只能在不可滚动的 View 之后出现。我设法通过将我的不可滚动布局放在“mainContent”之外,就在它下面来解决这个问题
关于android - 禁用 android CoordinatorLayout 滚动行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35486168/