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

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

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

GridLayoutManager.findFirstCompletelyVisibleItemPosition介绍

暂无

代码示例

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

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

代码示例来源:origin: GitLqr/LQRWeChat

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    if (dy > 0 && Math.abs(dy) > 10 && ((GridLayoutManager) mRvPOI.getLayoutManager()).findFirstCompletelyVisibleItemPosition() <= 1 && mRlMap.getHeight() == maxHeight) {
      LogUtils.sf("上拉缩小");
      setRlMapHeight(minHeight);
      UIUtils.postTaskDelay(() -> mRvPOI.moveToPosition(0), 0);
    } else if (dy < 0 && Math.abs(dy) > 10 && ((GridLayoutManager) mRvPOI.getLayoutManager()).findFirstCompletelyVisibleItemPosition() == 1 && mRlMap.getHeight() == minHeight) {
      LogUtils.sf("下拉放大");
      setRlMapHeight(maxHeight);
      UIUtils.postTaskDelay(() -> mRvPOI.moveToPosition(0), 0);
    }
  }
});

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

if (gridLayoutManager.findFirstCompletelyVisibleItemPosition() != 0) {
  int offset = (-recyclerView.getChildAt(0).getTop()) - recyclerView.getPaddingTop();
  targetY += offset;

代码示例来源:origin: captain-miao/RecyclerViewUtils

@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
  return layoutManager.findFirstCompletelyVisibleItemPosition() <= 0;
}

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

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

代码示例来源: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;
}

相关文章