本文整理了Java中android.support.v7.widget.GridLayoutManager.findLastCompletelyVisibleItemPosition()
方法的一些代码示例,展示了GridLayoutManager.findLastCompletelyVisibleItemPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.findLastCompletelyVisibleItemPosition()
方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:findLastCompletelyVisibleItemPosition
暂无
代码示例来源:origin: facebook/litho
@Override
public int findLastFullyVisibleItemPosition() {
return mGridLayoutManager.findLastCompletelyVisibleItemPosition();
}
代码示例来源:origin: TongmingWu/Manga
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
switch (newState) {
case RecyclerView.SCROLL_STATE_IDLE:
int position = manager.findLastCompletelyVisibleItemPosition();
if (position == manager.getItemCount() - 1) {
if (search.isNext()) {
loadMore(search.getCurrent_page() + 1);
} else {
// Toast.makeText(SearchActivity.this, "没有咯- -", Toast.LENGTH_SHORT).show();
rlProgress.setVisibility(View.VISIBLE);
pbMore.setVisibility(View.GONE);
tvMore.setText("已没有更多- -");
}
}
break;
case RecyclerView.SCROLL_STATE_DRAGGING:
break;
case RecyclerView.SCROLL_STATE_SETTLING:
break;
}
}
});
代码示例来源:origin: niniloveyou/SwipeRecyclerView
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
// do nothing if load more is not enable or refreshing or loading more
if(!isLoadMoreEnable || isRefreshing() || isLoadingMore){
return;
}
//get the lastVisiablePosition
mLayoutManager = recyclerView.getLayoutManager();
if(mLayoutManager instanceof LinearLayoutManager){
lastVisiablePosition = ((LinearLayoutManager)mLayoutManager).findLastVisibleItemPosition();
}else if(mLayoutManager instanceof GridLayoutManager){
lastVisiablePosition = ((GridLayoutManager)mLayoutManager).findLastCompletelyVisibleItemPosition();
}else if(mLayoutManager instanceof StaggeredGridLayoutManager){
int[] into = new int[((StaggeredGridLayoutManager) mLayoutManager).getSpanCount()];
((StaggeredGridLayoutManager) mLayoutManager).findLastVisibleItemPositions(into);
lastVisiablePosition = findMax(into);
}
int childCount = mWrapperAdapter == null ? 0 : mWrapperAdapter.getItemCount();
if(childCount > 1 && lastVisiablePosition == childCount - 1){
if(mListener != null){
isLoadingMore = true;
mListener.onLoadMore();
}
}
}
});
代码示例来源:origin: MrGaoGang/luckly_recyclerview
GridLayoutManager gridLayoutManager = (GridLayoutManager) manager;
lastItemPosition = gridLayoutManager.findLastCompletelyVisibleItemPosition();
itemCount = gridLayoutManager.getItemCount();
代码示例来源:origin: leftcoding/GankLy
case G:
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
if (gridLayoutManager.findLastCompletelyVisibleItemPosition() == 0) {
loadMore();
代码示例来源:origin: ShuKeW/TVRecyclerViewAndFocus
/**
* 是否是边缘的view
*
* @param view
* @return
*/
private boolean isNotTheEdgeView(View view) {
int position = getChildAdapterPosition(view);
if (position > -1) {
LayoutManager layoutManager = getLayoutManager();
if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
if (position >= linearLayoutManager.findFirstCompletelyVisibleItemPosition() && position <= linearLayoutManager.findLastCompletelyVisibleItemPosition()) {
return true;
}
} else if (layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
if (position >= gridLayoutManager.findFirstCompletelyVisibleItemPosition() && position <= gridLayoutManager.findLastCompletelyVisibleItemPosition()) {
return true;
}
} else if (layoutManager instanceof StaggeredGridLayoutManager) {
// TODO: 17/1/4
StaggeredGridLayoutManager staggeredGridLayoutManager = (StaggeredGridLayoutManager) layoutManager;
}
}
return false;
}
代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter
lastItem = gridLayoutManager.findLastCompletelyVisibleItemPosition();
if (lastItem == -1)
lastItem = gridLayoutManager.findLastVisibleItemPosition();
内容来源于网络,如有侵权,请联系作者删除!