gpt4 book ai didi

android - RecyclerView 不在折叠工具栏中滚动

转载 作者:太空宇宙 更新时间:2023-11-03 10:40:39 26 4
gpt4 key购买 nike

我在折叠工具栏布局中有一个非常简单的 RecyclerView。我已经尽我所能尝试了所有可能的标志/进行了研究,但无法使折叠的工具栏折叠。 Recycler 可以自由滚动,但 collapsingtoolbar 只是停留在那里,除非我滚动 collapsingtoolbar 本身。我做错了什么,有人可以帮忙吗?任何帮助将不胜感激..

XML 如下(为了保持代码简洁,删除了折叠工具栏的相对布局中的部分):

<!-- The CoordinatorLayout is used to coordinate (rly) scroll events between different views -->
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- The AppBar (everything above the scrolling content) -->
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/activity_main__app_bar"
android:fitsSystemWindows="true"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">



<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/activity_main__collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="0dp"
android:fitsSystemWindows="true"
app:contentScrim="@color/dark_for_menu"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:layout_collapseMode="parallax" >

<RelativeLayout
android:id="@+id/coverSwappsterMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

</RelativeLayout>


<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:layout_collapseMode="pin" >


</android.support.v7.widget.Toolbar>

</android.support.design.widget.CollapsingToolbarLayout>

</android.support.design.widget.AppBarLayout>




<android.support.v7.widget.RecyclerView
android:id="@+id/listSwappsterMode"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="@dimen/dp_500"
android:background="@color/dark_background"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
</android.support.v7.widget.RecyclerView>





</android.support.design.widget.CoordinatorLayout>

最佳答案

您需要将您的页面布局放在“嵌套 ScrollView ”中

<android.support.v4.widget.NestedScrollView>

包装 recyclerview 应该做到这一点。

关于android - RecyclerView 不在折叠工具栏中滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34574790/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com