androidx.recyclerview.widget.GridLayoutManager.setSpanSizeLookup()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(149)

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

GridLayoutManager.setSpanSizeLookup介绍

暂无

代码示例

代码示例来源:origin: alexvasilkov/GestureViews

@Override
public void onDetachedFromRecyclerView(RecyclerView recyclerView) {
  super.onDetachedFromRecyclerView(recyclerView);
  if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
    GridLayoutManager gridManager = (GridLayoutManager) recyclerView.getLayoutManager();
    gridManager.setSpanSizeLookup(originalSpanLookup);
    originalSpanLookup = null;
    spanCount = 1;
  }
}

代码示例来源:origin: alexvasilkov/GestureViews

@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
  super.onAttachedToRecyclerView(recyclerView);
  if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
    GridLayoutManager gridManager = (GridLayoutManager) recyclerView.getLayoutManager();
    spanCount = gridManager.getSpanCount();
    originalSpanLookup = gridManager.getSpanSizeLookup();
    gridManager.setSpanSizeLookup(spanSizes);
  }
}

代码示例来源:origin: airbnb/epoxy

/**
 * If a grid layout manager is set we sync the span count between the layout and the epoxy
 * adapter automatically.
 */
private void syncSpanCount() {
 LayoutManager layout = getLayoutManager();
 if (layout instanceof GridLayoutManager && epoxyController != null) {
  GridLayoutManager grid = (GridLayoutManager) layout;
  if (epoxyController.getSpanCount() != grid.getSpanCount()
    || grid.getSpanSizeLookup() != epoxyController.getSpanSizeLookup()) {
   epoxyController.setSpanCount(grid.getSpanCount());
   grid.setSpanSizeLookup(epoxyController.getSpanSizeLookup());
  }
 }
}

代码示例来源:origin: mikepenz/FastAdapter

gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override
  public int getSpanSize(int position) {

代码示例来源:origin: lisawray/groupie

populateAdapter();
layoutManager = new GridLayoutManager(this, groupAdapter.getSpanCount());
layoutManager.setSpanSizeLookup(groupAdapter.getSpanSizeLookup());

代码示例来源:origin: nickbutcher/plaid

layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override
  public int getSpanSize(int position) {

代码示例来源:origin: darkskygit/VirtualApp

private void setGridHeaderFooter(RecyclerView.LayoutManager layoutManager) {
  if (layoutManager instanceof GridLayoutManager) {
    final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
    gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
      @Override
      public int getSpanSize(int position) {
        boolean isShowHeader = (position == 0 && hasHeader());
        boolean isShowFooter = (position == getItemCount() - 1 && hasFooter());
        if (isShowFooter || isShowHeader) {
          return gridLayoutManager.getSpanCount();
        }
        return 1;
      }
    });
  }
}

代码示例来源:origin: contentful/gallery-app-android

private void createLayoutManager() {
 layoutManager = new GridLayoutManager(this, GRID_SPAN_COUNT);
 layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override public int getSpanSize(int position) {
   return adapter.isSection(position) ? GRID_SPAN_COUNT : 1;
  }
 });
}

代码示例来源:origin: yasevich/endless-recycler-view

@Override
  public void onClick(View v) {
    final GridLayoutManager manager = new GridLayoutManager(v.getContext(), 3);
    // we want progress view to fill entire row
    manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
      @Override
      public int getSpanSize(int position) {
        return list.isRefreshing() && position == manager.getItemCount() ?
            manager.getSpanCount() : 1;
      }
    });
    updateLayoutManager(manager);
  }
});

代码示例来源:origin: turing-tech/MaterialScrollBar

public static boolean initSpanSizeLookup(final RecyclerView rv, final IHeaderAdapter adapter)
{
  final RecyclerView.LayoutManager lm = rv.getLayoutManager();
  if(lm != null && lm instanceof GridLayoutManager)
  {
    ((GridLayoutManager)lm).setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
      @Override
      public int getSpanSize(int position) {
        if(rv == null)
          return 1;
        return adapter.isHeader(position) ? ((GridLayoutManager) lm).getSpanCount() : 1;
      }
    });
    return true;
  }
  return false;
}

代码示例来源:origin: pranavpandey/dynamic-support

if (recyclerView.getLayoutManager() instanceof GridLayoutManager) {
  ((GridLayoutManager) recyclerView.getLayoutManager())
      .setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {

代码示例来源:origin: crazysunj/MultiTypeRecyclerViewAdapter

layout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override
  public int getSpanSize(int position) {

代码示例来源:origin: YassinAJDI/PopularMovies

layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override
  public int getSpanSize(int position) {

代码示例来源:origin: akshay2211/PixImagePicker

mainImageAdapter = new MainImageAdapter(this);
GridLayoutManager mLayoutManager = new GridLayoutManager(this, MainImageAdapter.SPAN_COUNT);
mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
  @Override
  public int getSpanSize(int position) {

相关文章