All Projects → idisfkj → EnhanceRecyclerView

idisfkj / EnhanceRecyclerView

Licence: other
下拉刷新与上拉更多RecyclerView

Programming Languages

java
68154 projects - #9 most used programming language

EnhanceRecyclerView

依赖

compile 'com.idisfkj.enchancerecyclerview:mylibrary:1.1.1'

使用

xml中引用

<com.idisfkj.mylibrary.EnhanceRecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
</com.idisfkj.mylibrary.EnhanceRecyclerView>

设置监听

 mRecyclerView.setPullToRefreshListener(new com.idisfkj.mylibrary.EnhanceRecyclerView.PullToRefreshListener() {
            @Override
            public void onRefreshing() {
                refreshData();
            }
        });
        mRecyclerView.setLoadMoreListener(new EnhanceRecyclerView.LoadMoreListener() {
            @Override
            public void onLoadMore() {
                loadMoreData();
            }
        });

refreshData()loadMoreData()加载数据的逻辑就不展示了,只是要记住在请求网络数据完之后要在他们中调用相应的mRecyclerView.setRefreshComplete() mRecyclerView.setLoadMoreComplete()来重置状态。 至于其他的AdapterLayoutManager等的设置就不多说了,与原生的RecyclerView是一样的。

效果

效果图

详细说明

RecyclerView下拉刷新与上拉更多

License

Copyright (c) 2016. The Android Open Source Project
Created by idisfkj
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].