コード例 #1
0
 @Override
 public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
   if (mColumnWidthChanged && mColumnWidth > 0) {
     int totalSpace;
     if (getOrientation() == VERTICAL) {
       totalSpace = getWidth() - getPaddingRight() - getPaddingLeft();
     } else {
       totalSpace = getHeight() - getPaddingTop() - getPaddingBottom();
     }
     int spanCount = Math.max(1, totalSpace / mColumnWidth);
     setSpanCount(spanCount);
     mColumnWidthChanged = false;
   }
   super.onLayoutChildren(recycler, state);
 }
コード例 #2
0
 @Override
 public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
   updateSpanCount();
   super.onLayoutChildren(recycler, state);
 }
コード例 #3
0
 @Override
 public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
   super.onLayoutChildren(recycler, state);
 }