簡體   English   中英

RecyclerView不會在折疊工具欄中滾動

[英]RecyclerView not scrolling in Collapsing Toolbar

我在Collapsing Toolbar布局中有一個非常簡單的RecyclerView。 我已盡力嘗試每一個可能的旗幟/研究,但無法使我的折疊工具欄崩潰。 Recycler可以自由滾動,但是折疊工具欄只是停留在那里,除非我滾動折疊工具欄本身。 我做錯了什么,有人可以幫忙嗎? 任何幫助將非常感謝..

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>

您需要將頁面布局放在“嵌套滾動視圖”中

<android.support.v4.widget.NestedScrollView>

包裝recyclerview應該這樣做。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM