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

How to make IRecyclerView works with SwipeRefreshLayout #7

Closed Aspsine closed 8 years ago

Aspsine commented 8 years ago

使用SwipeRefreshLayout的下拉刷新不起作用,换成普通的RecyclerView就正常了,请问,使用SwipeRefreshLayout的下拉刷新应该怎么使用?

@ruanjianbai

Aspsine commented 8 years ago

@ruanjianbai

public class ISwipeRefreshLayout extends SwipeRefreshLayout {

    public ISwipeRefreshLayout(Context context) {
        super(context);
    }

    public ISwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean canChildScrollUp() {
        if (isRefreshing()){
            return true;
        }
        return false;
    }
}
<com.aspsine.irecyclerview.demo.ui.widget.ISwipeRefreshLayout 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:id="@+id/swipeRefreshLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.aspsine.irecyclerview.IRecyclerView
        android:id="@+id/iRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:loadMoreEnabled="true"
        app:loadMoreFooterLayout="@layout/layout_irecyclerview_load_more_footer"
        app:refreshEnabled="false" />
</com.aspsine.irecyclerview.demo.ui.widget.ISwipeRefreshLayout>
ruanjianbai commented 8 years ago

谢谢!解决了,好及时啊!