0
は私がその時に上記のコードを実行するとき、私はフォーカス問題が
mRecyclerView.setOnScrollListener(new EndlessRecyclerOnScrollListener(
mLayoutManager) {
@Override
public void onLoadMore(int current_page) {
if (SolutionEnterprises.mGetRCAAcceptedListDatas.size() < 100) {
from = from + limit;
new getHomeTicketList(false).execute();
}
}
});
次のようにクラスの上に呼び出す私のフラグメントクラスで1つのendlessrecycleviewチェックコード
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends
RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class
.getSimpleName();
private int previousTotal = 0;
private boolean loading = true;
private int visibleThreshold = 5;
int firstVisibleItem, visibleItemCount, totalItemCount;
private int current_page = 1;
private LinearLayoutManager mLinearLayoutManager;
public EndlessRecyclerOnScrollListener(
LinearLayoutManager linearLayoutManager) {
this.mLinearLayoutManager = linearLayoutManager;
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
visibleItemCount = recyclerView.getChildCount();
totalItemCount = mLinearLayoutManager.getItemCount();
firstVisibleItem = mLinearLayoutManager.findFirstVisibleItemPosition();
if (loading) {
if (totalItemCount > previousTotal) {
loading = false;
previousTotal = totalItemCount;
}
}
if (!loading
&& (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) {
// End has been reached
// Do something
current_page++;
onLoadMore(current_page);
loading = true;
}
}
public abstract void onLoadMore(int current_page);
}
下回っていanroid私のリサイクルビューで5つのアイテムをスクロールすると、それは良いですが、の問題は5番目のアイテムscrooll recycleview foucsの後に再び呼び出されるので、どのようにこの問題を解決できますか?