Aspsine / IRecyclerView

IRecyclerView is a custom RecyclerView that supports pull-to-refresh, pull-to-loadmore, customize refresh header and loadmore footer, add header views and footer views.
729 stars 146 forks source link

请教下当使用在可折叠工具栏布局的时候的问题 #2

Open jyh149129 opened 8 years ago

jyh149129 commented 8 years ago

基本布局为: CoordinatorLayout+IRecyclerView :页面主要部分 AppBarLayout+ CollapsingToolbarLayout+Toolbar:页面顶部工具栏

来实现滑动下方rv的时候折叠和展开toolbar,用您的SwipeToLoadLayout组件时,运作都是正常的。但换成IRecyclerView后,当向上滑动rv折叠工具栏后,便无法再下滑rv展开toolbar,而且滑动rv有点卡顿。

Aspsine commented 8 years ago
<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".ui.activity.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="256dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="true"
                android:scaleType="centerCrop"
                app:layout_collapseMode="parallax" />

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

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

    <com.aspsine.irecyclerview.IRecyclerView
        android:id="@+id/iRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:loadMoreEnabled="true"
        app:loadMoreFooterLayout="@layout/layout_irecyclerview_load_more_footer"
        app:refreshEnabled="true"
        app:refreshHeaderLayout="@layout/layout_irecyclerview_refresh_header" />

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

类似于这种布局? 这种布局的刷新一般采取两种策略。 1.类似于 ‘知乎专栏’ ,把SwipeRefreshLayout包在CoordinatorLayout的外层。 2.类似于微博个人主页,和qq空间主页。下拉parallax ImageView,的这种效果。

但是如果在IRecyclerView中做刷新,就会感觉很奇怪。

Anyway, Nested Scroll的问题我会尽量解决。 如果项目紧急,建议使用SwipeRefreshLayout的下拉刷新+IRecylerView加载更多的结合方案。

jyh149129 commented 8 years ago

是的,类似于您给的那个布局。按道理来说rv应该是原生支持Nested Scroll的吧?折叠的时候是正常的,只是下滑rv的时候无法展开。。。我暂时用您的SwipeToLoadLayout库替代了,我先去看看知乎的布局

wenlongwangl commented 6 years ago

@jyh149129 哥们,这种布局你怎么解决的啊,SwipeToLoadLayout 也会出现无法展开的情况

@Aspsine 哥们,IRecyclerView 的 Nested Scroll 暂没解决,是么