compile 'com.idisfkj.enchancerecyclerview:mylibrary:1.1.1'
<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()
来重置状态。
至于其他的Adapter
、LayoutManager
等的设置就不多说了,与原生的RecyclerView
是一样的。
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.