gpt4 book ai didi

cn.youngkaaa.yviewpager.YPagerAdapter.getPageWidth()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 15:11:31 26 4
gpt4 key购买 nike

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

YPagerAdapter.getPageWidth介绍

[英]Returns the proportional width of a given page as a percentage of the ViewPager's measured width from (0.f-1.f]
[中]从(0.f-1.f)返回给定页面的比例宽度,作为ViewPager测量宽度的百分比

代码示例

代码示例来源:origin: open-android/ViewPager

/**
 * 根据传入的position来构造一个ItemInfo对象的实例  然后加入到mItems中去
 *
 * @param position
 * @param index
 * @return
 */
ItemInfo addNewItem(int position, int index) {
  ItemInfo ii = new ItemInfo();
  ii.position = position;
  ii.object = mAdapter.instantiateItem(this, position);
  ii.widthFactor = mAdapter.getPageWidth(position);
  if (index < 0 || index >= mItems.size()) {
    mItems.add(ii);
  } else {
    mItems.add(index, ii);
  }
  return ii;
}

代码示例来源:origin: open-android/ViewPager

ItemInfo addNewItem(int position, int index) {
  int newPos = position % mAdapter.getCount();
  Log.d(TAG, "addNewItem newPos=>" + newPos + ",position=>" + position);
  if (newPos == 0) {
    mCurrentStartPos = position;
    Log.d(TAG, "addNewItem mCurrentStartPos=>" + mCurrentStartPos);
  }
  ItemInfo ii = new ItemInfo();
  ii.position = position;
  ii.object = mAdapter.instantiateItem(this, newPos);
  ii.widthFactor = mAdapter.getPageWidth(newPos);
  if (index < 0 || index >= mItems.size()) {
    mItems.add(ii);
  } else {
    mItems.add(index, ii);
  }
  return ii;
}

代码示例来源:origin: open-android/ViewPager

offset += mAdapter.getPageWidth(pos) + marginOffset;
      pos++;
      offset -= mAdapter.getPageWidth(pos) + marginOffset;
      pos--;
  offset -= mAdapter.getPageWidth(pos--) + marginOffset;
final ItemInfo ii = mItems.get(i);
while (pos < ii.position) {
  offset += mAdapter.getPageWidth(pos++) + marginOffset;

代码示例来源:origin: open-android/ViewPager

offset += mAdapter.getPageWidth(pos) + marginOffset;
      pos++;
      offset -= mAdapter.getPageWidth(pos) + marginOffset;
      pos--;
  offset -= mAdapter.getPageWidth(pos--) + marginOffset;
final ItemInfo ii = mItems.get(i);
while (pos < ii.position) {
  offset += mAdapter.getPageWidth(pos++) + marginOffset;

代码示例来源:origin: open-android/ViewPager

offset += mAdapter.getPageWidth(pos) + marginOffset;
      pos++;
      offset -= mAdapter.getPageWidth(pos) + marginOffset;
      pos--;
  offset -= mAdapter.getPageWidth(pos--) + marginOffset;
final ItemInfo ii = mItems.get(i);
while (pos < ii.position) {
  offset += mAdapter.getPageWidth(pos++) + marginOffset;

代码示例来源:origin: open-android/ViewPager

offset += mAdapter.getPageWidth(pos) + marginOffset;
      pos++;
      offset -= mAdapter.getPageWidth(pos) + marginOffset;
      pos--;
  offset -= mAdapter.getPageWidth(pos--) + marginOffset;
final ItemInfo ii = mItems.get(i);
while (pos < ii.position) {
  offset += mAdapter.getPageWidth(pos++) + marginOffset;

代码示例来源:origin: open-android/ViewPager

ii.offset = lastOffset + lastHeight + marginOffset;
ii.position = lastPos + 1;
ii.widthFactor = mAdapter.getPageWidth(ii.position);
i--;

代码示例来源:origin: open-android/ViewPager

ii.offset = lastOffset + lastWidth + marginOffset;
ii.position = lastPos + 1;
ii.widthFactor = mAdapter.getPageWidth(ii.position);
i--;

代码示例来源:origin: open-android/ViewPager

offset = ii.offset + ii.widthFactor + marginOffsetHorizontal;
} else if (!isVertical) {
  float widthFactor = mAdapter.getPageWidth(pos);
  drawAt = (offset + widthFactor) * width;
  offset += widthFactor + marginOffsetHorizontal;
  offset = ii.offset + ii.widthFactor + marginOffsetVertical;
} else if (isVertical) {
  float widthFactor = mAdapter.getPageWidth(pos);
  drawAt = (offset + widthFactor) * height;
  offset += widthFactor + marginOffsetVertical;

代码示例来源:origin: open-android/ViewPager

offset = ii.offset + ii.widthFactor + marginOffsetHorizontal;
} else if (!isVertical) {
  float widthFactor = mAdapter.getPageWidth(pos);
  drawAt = (offset + widthFactor) * width;
  offset += widthFactor + marginOffsetHorizontal;
  offset = ii.offset + ii.widthFactor + marginOffsetVertical;
} else if (isVertical) {
  float widthFactor = mAdapter.getPageWidth(pos);
  drawAt = (offset + widthFactor) * height;
  offset += widthFactor + marginOffsetVertical;

代码示例来源:origin: open-android/ViewPager

ii.offset = lastOffset + lastWidth + marginOffset;
ii.position = lastPos + 1;
ii.widthFactor = mAdapter.getPageWidth(ii.position);
i--;

代码示例来源:origin: open-android/ViewPager

ii.offset = lastOffset + lastHeight + marginOffset;
ii.position = lastPos + 1;
ii.widthFactor = mAdapter.getPageWidth(ii.position);
i--;

代码示例来源:origin: open-android/ViewPager

duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
} else {
  final float pageHeight = height * mAdapter.getPageWidth(mCurItem);
  final float pageDelta = (float) Math.abs(dy) / (pageHeight + mPageMargin);
  duration = (int) ((pageDelta + 1) * 100);

代码示例来源:origin: open-android/ViewPager

duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
} else {
  final float pageWidth = width * mAdapter.getPageWidth(mCurItem);
  final float pageDelta = (float) Math.abs(dx) / (pageWidth + mPageMargin);
  duration = (int) ((pageDelta + 1) * 100);

代码示例来源:origin: open-android/ViewPager

duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
} else {
  final float pageHeight = height * mAdapter.getPageWidth(mCurItem);
  final float pageDelta = (float) Math.abs(dy) / (pageHeight + mPageMargin);
  duration = (int) ((pageDelta + 1) * 100);

代码示例来源:origin: open-android/ViewPager

duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
} else {
  final float pageWidth = width * mAdapter.getPageWidth(mCurItem);
  final float pageDelta = (float) Math.abs(dx) / (pageWidth + mPageMargin);
  duration = (int) ((pageDelta + 1) * 100);

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