将NestedScrollView应用于活动后,工具栏不会与内容一起滚动。我尝试了很多滚动选项和标志。高度和宽度参数不在此处写入。
<android.support.design.widget.AppBarLayout
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:collapsedTitleGravity="fill_vertical">
<android.support.v7.widget.Toolbar
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:overScrollMode="always"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="a.fruitsbook.ScrollingActivity"
tools:showIn="@layout/activity_scrolling"
android:overScrollMode="always">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerViewScroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.NestedScrollView>
答案 0 :(得分:0)
删除NestedScrollView和
在recyclerView中添加app:layout_behavior =“@ string / appbar_scrolling_view_behavior”。