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

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

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

GridLayoutManager.getItemCount介绍

暂无

代码示例

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

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

代码示例来源:origin: 66668/DropDownMenuplus

/**
 * Returns the number of items in the adapter bound to the parent RecyclerView.
 * @return The number of items in the bound adapter
 */
@Override
public int getItemCount() {
  return super.getItemCount();
}

代码示例来源:origin: Dawish/BriskTVLauncher

/**
 * Returns the number of items in the adapter bound to the parent RecyclerView.
 * @return The number of items in the bound adapter
 */
@Override
public int getItemCount() {
  return super.getItemCount();
}

代码示例来源:origin: Dreamxiaoxuan/AndroidTvDemo

/**
 * Returns the number of items in the adapter bound to the parent RecyclerView.
 * 
 * @return The number of items in the bound adapter
 */
@Override
public int getItemCount()
{
  return super.getItemCount();
}

代码示例来源:origin: dongorigin/AndroidDemo

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    super.onScrolled(recyclerView, dx, dy);
    if (mScrollListener != null) {
      mScrollListener.onScrolled(recyclerView, dx, dy);
    }
    if (mEnableLoadMore && mEnableAutoLoadMore && !mLoading && mLayoutManager.findLastVisibleItemPosition() == mLayoutManager.getItemCount() - 1) {
      // 开启加载更多,并且列表滑动到最后一项
      performLoadMore();
    }
  }
});

代码示例来源:origin: easemob/livestream_demo_android

@Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if(newState == RecyclerView.SCROLL_STATE_IDLE
        && hasMoreData
        && !isLoading
        && glm.findLastVisibleItemPosition() == glm.getItemCount() -1){
      showLiveList(true);
    }
  }
});

代码示例来源:origin: dom4j1/Red

@Override
  public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
    if (dy > 0) {
      int lastPosition = mLayoutManager.findLastVisibleItemPosition();
      int count = mLayoutManager.getItemCount();
      if (lastPosition + 1 == count && lastPosition + 2 != lastCount) {
        lastCount = count;
        loadMore();
      }
    }
    super.onScrolled(recyclerView, dx, dy);
  }
}

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

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
  if (newState == RecyclerView.SCROLL_STATE_IDLE) {
    lastVisibleItem = layoutManager
        .findLastVisibleItemPosition();
    if (layoutManager.getItemCount() == 1) {
      return;
    }
    if (lastVisibleItem + 1 == layoutManager
        .getItemCount()) {
      gankFgView.setDataRefresh(true);
      isLoadMore = true;
      mHandler.postDelayed(() -> getGankData(), 1000);
    }
  }
}

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

@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
  super.onScrollStateChanged(recyclerView, newState);
  if (newState == RecyclerView.SCROLL_STATE_IDLE) {
    lastVisibleItem = layoutManager
        .findLastVisibleItemPosition();
    if (layoutManager.getItemCount() == 1) {
      return;
    }
    if (lastVisibleItem + 1 == layoutManager
        .getItemCount()) {
      if(has_more.equals("true")) {
        isLoadMore = true;
        dailyFeedView.setDataRefresh(true);
        mHandler.postDelayed(() -> getDailyFeedDetail(d_id,next_pager), 1000);
      }
    }
  }
}

代码示例来源:origin: wangxp423/ViewExercise

GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
int totalCount = layoutManager.getItemCount();
int surplusCount = totalCount % layoutManager.getSpanCount();
int childPosition = parent.getChildAdapterPosition(view);

代码示例来源:origin: ShuKeW/TVRecyclerViewAndFocus

if (gridLayoutManager.canScrollHorizontally()) {
  if (RecyclerViewUtil.isLastGridRaw(parent, view)) {// 如果是最后一列
    if (parent.getChildAdapterPosition(view) == gridLayoutManager.getItemCount() - 1) {// 最后一个
      outRect.set(0, 0, mLastDividerSize, 0);
    } else {
    if (parent.getChildAdapterPosition(view) == gridLayoutManager.getItemCount() - 1) {
      outRect.set(0, 0, 0, mLastDividerSize);
    } else {

代码示例来源: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: ShuKeW/TVRecyclerViewAndFocus

GridLayoutManager.SpanSizeLookup spanSizeLookUp = gridLayoutManager.getSpanSizeLookup();
int childPosition = parent.getChildAdapterPosition(view);
int itemCount = gridLayoutManager.getItemCount();
int spanCountTotal = 0;
int spanCountChild = 0;

代码示例来源:origin: MuhamedFathy/YTS

private void activateEndlessScroll(RecyclerView recyclerView, GridLayoutManager manager) {
 RxRecyclerView.scrollEvents(recyclerView)
   .subscribe(scrollEvent -> {
    visibleItemCount = recyclerView.getChildCount();
    totalItemCount = manager.getItemCount();
    firstVisibleItem = manager.findFirstVisibleItemPosition();
    if (loading) {
     if (totalItemCount > previousTotal) {
      loading = false;
      previousTotal = totalItemCount;
     }
    }
    if (!loading && (totalItemCount - visibleItemCount)
      <= (firstVisibleItem + visibleThreshold)) {
     pageNum++;
     presenter.loadMoviesList(getContext(), pageNum, false);
     loading = true;
    }
   });
}

代码示例来源:origin: wangxp423/ViewExercise

int totalCount = layoutManager.getItemCount();
int surplusCount = totalCount % layoutManager.getSpanCount();

代码示例来源:origin: AppLozic/Applozic-Android-SDK

GridLayoutManager gridLayoutManager = (GridLayoutManager) manager;
  firstVisibleItem = gridLayoutManager.findFirstVisibleItemPosition();
  totalItemCount = gridLayoutManager.getItemCount();
} else if (manager instanceof LinearLayoutManager) {
  LinearLayoutManager linearLayoutManager = (LinearLayoutManager) manager;

代码示例来源:origin: msahakyan/nested-recycler-view

private void loadMoreItems() {
  if (mTotalPageSize > mCurrentPage) {
    int visibleItemCount = mLayoutManager.getChildCount();
    int totalItemCount = mLayoutManager.getItemCount();
    int pastVisibleItems = mLayoutManager.findFirstVisibleItemPosition();
    if (!mLoading) {
      if ((visibleItemCount + pastVisibleItems) >= totalItemCount) {
        mLoading = true;
        Log.v(TAG, "Reached last Item!");
        // Fetching new data...
        if (mShouldLoadSimilarItems) {
          initSimilarMoviesEndpointAndUrlParams(mMovieId, ++mCurrentPage);
        } else {
          initEndpointAndUrlParams(++mCurrentPage);
        }
        mDialog.setMessage(getString(R.string.loading_more_data));
        mDialog.getWindow().setGravity(Gravity.BOTTOM);
        mDialog.show();
        loadMovieList(true);
      }
    }
  }
}

代码示例来源:origin: MrGaoGang/luckly_recyclerview

itemCount = gridLayoutManager.getItemCount();

相关文章