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

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

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

GridLayoutManager.onLayoutChildren介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
  if (mColumnSizeChanged && mColumnSize > 0) {
    int totalSpace;
    if (getOrientation() == VERTICAL) {
      totalSpace = getWidth() - getPaddingRight() - getPaddingLeft();
    } else {
      totalSpace = getHeight() - getPaddingTop() - getPaddingBottom();
    }
    int spanCount;
    switch (mStrategy) {
      default:
      case STRATEGY_MIN_SIZE:
        spanCount = getSpanCountForMinSize(totalSpace, mColumnSize);
        break;
      case STRATEGY_SUITABLE_SIZE:
        spanCount = getSpanCountForSuitableSize(totalSpace, mColumnSize);
        break;
    }
    setSpanCount(spanCount);
    mColumnSizeChanged = false;
    if (null != mListeners) {
      for (int i = 0, n = mListeners.size(); i < n; i++) {
        mListeners.get(i).onUpdateSpanCount(spanCount);
      }
    }
  }
  super.onLayoutChildren(recycler, state);
}

代码示例来源:origin: yaozs/ImageShowPicker

@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
  //override this method and implement code as below
  try {
    super.onLayoutChildren(recycler, state);
  } catch (Exception e) {
    e.printStackTrace();
  }
}

相关文章