android.support.v7.widget.GridLayoutManager.findLastVisibleItemPosition()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中android.support.v7.widget.GridLayoutManager.findLastVisibleItemPosition()方法的一些代码示例,展示了GridLayoutManager.findLastVisibleItemPosition()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridLayoutManager.findLastVisibleItemPosition()方法的具体详情如下:
包路径:android.support.v7.widget.GridLayoutManager
类名称:GridLayoutManager
方法名:findLastVisibleItemPosition

GridLayoutManager.findLastVisibleItemPosition介绍

暂无

代码示例

代码示例来源:origin: facebook/litho

@Override
public int findLastVisibleItemPosition() {
 return mGridLayoutManager.findLastVisibleItemPosition();
}

代码示例来源:origin: aa112901/remusic

@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
  super.onScrolled(recyclerView, dx, dy);
  lastVisibleItem = gridLayoutManager.findLastVisibleItemPosition();
}

代码示例来源:origin: jiangqqlmj/FastDev4Android

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = gridLayoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: zhihu/Matisse

public void refreshSelection() {
  GridLayoutManager layoutManager = (GridLayoutManager) mRecyclerView.getLayoutManager();
  int first = layoutManager.findFirstVisibleItemPosition();
  int last = layoutManager.findLastVisibleItemPosition();
  if (first == -1 || last == -1) {
    return;
  }
  Cursor cursor = getCursor();
  for (int i = first; i <= last; i++) {
    RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(first);
    if (holder instanceof MediaViewHolder) {
      if (cursor.moveToPosition(i)) {
        setCheckStatus(Item.valueOf(cursor), ((MediaViewHolder) holder).mMediaGrid);
      }
    }
  }
}

代码示例来源:origin: Hitomis/transferee

private void fillByRecyclerView(final List<ImageView> originImageList) {
  RecyclerView recyclerView = transConfig.getRecyclerView();
  int childCount = recyclerView.getChildCount();
  for (int i = 0; i < childCount; i++) {
    ImageView originImage = ((ImageView) recyclerView.getChildAt(i)
        .findViewById(transConfig.getImageId()));
    originImageList.add(originImage);
  }
  RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
  int firstPos = 0, lastPos = 0;
  int totalCount = layoutManager.getItemCount();
  if (layoutManager instanceof GridLayoutManager) {
    GridLayoutManager gridLayMan = (GridLayoutManager) layoutManager;
    firstPos = gridLayMan.findFirstVisibleItemPosition();
    lastPos = gridLayMan.findLastVisibleItemPosition();
  } else if (layoutManager instanceof LinearLayoutManager) {
    LinearLayoutManager linLayMan = (LinearLayoutManager) layoutManager;
    firstPos = linLayMan.findFirstVisibleItemPosition();
    lastPos = linLayMan.findLastVisibleItemPosition();
  }
  fillPlaceHolder(originImageList, totalCount, firstPos, lastPos);
}

代码示例来源:origin: iMeiji/Toutiao

if (gridLayoutManager.findLastVisibleItemPosition() == getItemCount() - 1) {
if (currentPosition == gridLayoutManager.findLastVisibleItemPosition()
    && (currentPosition - mMyChannelItems.size() - COUNT_PRE_OTHER_HEADER) % spanCount != 0
    && (targetPosition - COUNT_PRE_MY_HEADER) % spanCount != 0) {

代码示例来源:origin: jdsjlzx/LRecyclerView

case GridLayout:
  firstVisibleItemPosition = ((GridLayoutManager) layoutManager).findFirstVisibleItemPosition();
  lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
  break;
case StaggeredGridLayout:

代码示例来源:origin: jdsjlzx/LRecyclerView

case GridLayout:
  firstVisibleItemPosition = ((GridLayoutManager) layoutManager).findFirstVisibleItemPosition();
  lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
  break;
case StaggeredGridLayout:

代码示例来源:origin: cundong/HeaderAndFooterRecyclerView

break;
case GridLayout:
  lastVisibleItemPosition = ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
  break;
case StaggeredGridLayout:

代码示例来源:origin: weexteam/weex-hackernews

case GRID:
 lastVisibleItemPosition = ((GridLayoutManager) layoutManager)
   .findLastVisibleItemPosition();
 break;
case STAGGERED_GRID:

代码示例来源:origin: hymanme/MaterialHome

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
  }
}

代码示例来源:origin: hymanme/MaterialHome

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: ryanlijianchang/PullToLoadData-RecyclerView

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: CoderGuoy/Coder

@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
  super.onScrolled(recyclerView, dx, dy);
  // 在滑动完成后,拿到最后一个可见的item的位置
  lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
}

代码示例来源:origin: HomHomLin/Android-PullToRefreshRecyclerView

public int findLastVisibleItemPosition(RecyclerView.LayoutManager layoutManager){
  if(layoutManager != null) {
    if (layoutManager instanceof LinearLayoutManager) {
      return ((LinearLayoutManager) layoutManager).findLastVisibleItemPosition();
    }
    if (layoutManager instanceof GridLayoutManager) {
      return ((GridLayoutManager) layoutManager).findLastVisibleItemPosition();
    }
  }
  return RecyclerView.NO_POSITION;
}

代码示例来源:origin: Werb/GankWithZhihu

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = layoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: Werb/GankWithZhihu

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = layoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: hymanme/MaterialHome

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: hymanme/MaterialHome

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    lastVisibleItem = mLayoutManager.findLastVisibleItemPosition();
  }
});

代码示例来源:origin: WangDaYeeeeee/Mysplash

@Override
public void requestPhotoFailed() {
  if (recyclerView.getLayoutManager() != null
      && recyclerView.getLayoutManager() instanceof GridLayoutManager
      && ((GridLayoutManager) recyclerView.getLayoutManager()).findLastVisibleItemPosition() == 2) {
    ProgressHolder holder = (ProgressHolder) recyclerView.findViewHolderForAdapterPosition(2);
    if (holder != null) {
      holder.setFailedState();
    }
  }
}

相关文章