EasyRecyclerView
EasyRecyclerView 支援添加header、footer,設定空白頁面(無資料,網絡異常顯示)。
上拉加載更多,加載狀态,網絡異常狀态,資料到底狀态。
分頁加載的全部解決方案,可以直接應用到項目中
github位址:https://github.com/hellosliu/EasyRecyclerView
使用
android studio 添加gradle
compile 'com.hellosliu.easyrecyclerview:easyrecyclerview:1.3.3'
添加header、footer,使用EasyRecylerView
View header = layoutInflater.inflate(R.layout.view_customer_header, null);
View footer = layoutInflater.inflate(R.layout.view_customer_footer, null);
EasyRecylerView recylerView = (EasyRecylerView)findViewById(R.id.recycleview_header_footer);
recylerView.setLayoutManager(new LinearLayoutManager(this));
recylerView.addHeaderView(header); //添加header
recylerView.addFootView(footer); //添加footer
recylerView.setAdapter(adapter);
recylerView.showEmptyView(emptyView); //顯示無資料view
recylerView.showEmptyView(networkErrorView); //顯示網絡異常view
</pre><h3 style="color:rgb(51,51,51)"><span style="font-size:18px">上拉加載更多,分頁加載,使用LoadMoreRecylerView</span></h3><pre name="code" class="java" style="color: rgb(51, 51, 51);"><span style="font-size:18px;"></span><pre name="code" class="java">View header = layoutInflater.inflate(R.layout.view_customer_header, null);
LoadMoreRecylerView recylerView = (LoadMoreRecylerView)findViewById(R.id.recycleview_loading);
recylerView.setLayoutManager(new LinearLayoutManager(this));
recylerView.addHeaderView(header);
//設定加載更多監聽
recylerView.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh() { //上拉loading
getMoreData();
}
@Override
public void onReload() { //網絡異常時,點選重新擷取資料
getMoreData();
}
});
recylerView.setAdapter(adapter);
</pre><h3>更多操作</h3><span style="font-size:14px;">設定加載中、網絡異常、資料到底文字</span></div><div><pre name="code" class="java">recylerView.setSampleLoadText("Loading...", "NetWork Error", "Data End");
自定義加載中、網絡異常、資料到底顯示view
recylerView.setCustomerLoadFooter(loadingView, networkErrorView, dataEndView);
EasyRecyclerView覺得好用,請在Github上面星星
</pre></div><div><span style="font-size:18px"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"><span style="font-size:18px"></span></span></span></div><div><span style="font-size:18px"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"><span style="font-size:18px"></span></span></span></div><div><span style="font-size:18px"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"><span style="font-size:18px"></span></span></span></div><div><span style="font-size:18px"></span><pre style="overflow:auto; font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace; font-size:14px; margin-top:0px; margin-bottom:0px; line-height:1.45; padding:16px; word-wrap:normal; word-break:normal; color:rgb(51,51,51); widows:auto; background-color:rgb(247,247,247)"><span class="pl-s" style="color:rgb(24,54,145)"><span class="pl-pds" style="">
</span></span>