gpt4 book ai didi

com.yanyusong.y_divideritemdecoration.Y_DividerBuilder.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 13:21:31 33 4
gpt4 key购买 nike

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

Y_DividerBuilder.<init>介绍

暂无

代码示例

代码示例来源:origin: yanyusong/Y_DividerItemDecoration

@Override
  public Y_Divider getDivider(int itemPosition) {
    Y_Divider divider = null;
    switch (itemPosition % 3) {
      case 0:
      case 1:
        //每一行第一个和第二个显示rignt和bottom
        divider = new Y_DividerBuilder()
            .setRightSideLine(true, 0xff666666, 6, 0, 0)
            .setBottomSideLine(true, 0xff666666, 6, 0, 0)
            .create();
        break;
      case 2:
        //最后一个只显示bottom
        divider = new Y_DividerBuilder()
            .setBottomSideLine(true, 0xff666666, 6, 0, 0)
            .create();
        break;
      default:
        break;
    }
    return divider;
  }
}

代码示例来源:origin: yanyusong/Y_DividerItemDecoration

Y_Divider divider = null;
if ((itemPosition >= 1 && itemPosition <= 6) || itemPosition == 9 || itemPosition == 10) {
  divider = new Y_DividerBuilder()
      .setBottomSideLine(true, 0xff666666, 6, 0, 0)
      .create();
} else if (itemPosition == 0 || itemPosition == 7 || itemPosition == 8) {
  divider = new Y_DividerBuilder()
      .setRightSideLine(true, 0xff666666, 6, 0, 0)
      .setBottomSideLine(true, 0xff666666, 6, 0, 0)
    case 2:
    case 3:
      divider = new Y_DividerBuilder()
          .setRightSideLine(true, 0xff666666, 6, 0, 0)
          .setBottomSideLine(true, 0xff666666, 6, 0, 0)
      break;
    case 0:
      divider = new Y_DividerBuilder()
          .setBottomSideLine(true, 0xff666666, 6, 0, 0)
          .create();

代码示例来源:origin: yanyusong/Y_DividerItemDecoration

@Override
  public Y_Divider getDivider(int itemPosition) {
    Y_Divider divider = null;
    switch (itemPosition % 2) {
      case 0:
        //每一行第一个显示rignt和bottom
        divider = new Y_DividerBuilder()
            .setRightSideLine(true, 0xff666666, 10, 0, 0)
            .setBottomSideLine(true, 0xff666666, 20, 0, 0)
            .create();
        break;
      case 1:
        //第二个显示Left和bottom
        divider = new Y_DividerBuilder()
            .setLeftSideLine(true, 0xff666666, 10, 0, 0)
            .setBottomSideLine(true, 0xff666666, 20, 0, 0)
            .create();
        break;
      default:
        break;
    }
    return divider;
  }
}

代码示例来源:origin: yanyusong/Y_DividerItemDecoration

switch (itemPosition) {
  case 0:
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xffFF4081, 6, 0, 0)
        .create();
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xff666666, 6, 0, 0)
        .create();
    break;
  case 2:
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xffFF4081, 4, 0, 0)
        .create();
    break;
  case 3:
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xffFF4081, 6, 16, 16)
        .create();
    break;
  case 4:
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xffFF4081, 6, 16, 32)
        .create();
    break;
  case 5:
    divider = new Y_DividerBuilder()
        .setBottomSideLine(true, 0xffFF4081, 6, 0, 0)
        .create();

代码示例来源:origin: yanyusong/Y_DividerItemDecoration

@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
  //outRect 看源码可知这里只是把Rect类型的outRect作为一个封装了left,right,top,bottom的数据结构,
  //作为传递left,right,top,bottom的偏移值来用的
  int itemPosition = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
  Y_Divider divider = getDivider(itemPosition);
  if (divider == null) {
    divider = new Y_DividerBuilder().create();
  }
  int left = divider.getLeftSideLine().isHave() ? Dp2Px.convert(context, divider.getLeftSideLine().getWidthDp()) : 0;
  int top = divider.getTopSideLine().isHave() ? Dp2Px.convert(context, divider.getTopSideLine().getWidthDp()) : 0;
  int right = divider.getRightSideLine().isHave() ? Dp2Px.convert(context, divider.getRightSideLine().getWidthDp()) : 0;
  int bottom = divider.getBottomSideLine().isHave() ? Dp2Px.convert(context, divider.getBottomSideLine().getWidthDp()) : 0;
  outRect.set(left, top, right, bottom);
}

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com