gpt4 book ai didi

com.zyyoona7.picker.ex.YearWheelView类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 12:37:31 25 4
gpt4 key购买 nike

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

YearWheelView介绍

[英]年 WheelView
[中]年 车轮视图

代码示例

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 获取当前选中的年份
 *
 * @return 当前选中的年份
 */
public int getSelectedYear() {
  return getSelectedItemData();
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 获取选中的年份
 *
 * @return 选中的年份
 */
public int getSelectedYear() {
  return mYearWv.getSelectedYear();
}

代码示例来源:origin: zyyoona7/WheelPicker

yearWv.setOnItemSelectedListener(new WheelView.OnItemSelectedListener<Integer>() {
  @Override
  public void onItemSelected(WheelView<Integer> wheelView, Integer data, int position) {
customDpv1.setTextSize(24, true);
customDpv1.setShowLabel(false);
customDpv1.getYearWv().setTextBoundaryMargin(16, true);
customDpv1.getMonthWv().setTextBoundaryMargin(16, true);
customDpv1.getDayWv().setTextBoundaryMargin(16, true);
MonthWheelView monthWv3 = customDpv3.getMonthWv();
DayWheelView dayWv3 = customDpv3.getDayWv();
yearWv3.setIntegerNeedFormat("%d年");
monthWv3.setIntegerNeedFormat("%d月");
dayWv3.setIntegerNeedFormat("%02d日");
yearWv3.setCurvedArcDirection(WheelView.CURVED_ARC_DIRECTION_LEFT);
yearWv3.setCurvedArcDirectionFactor(0.65f);
dayWv3.setCurvedArcDirection(WheelView.CURVED_ARC_DIRECTION_RIGHT);
dayWv3.setCurvedArcDirectionFactor(0.65f);

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置WheelView 文字距离边界的外边距
 *
 * @param textBoundaryMargin 外边距值
 * @param isDp               单位是否为 dp
 */
public void setTextBoundaryMargin(float textBoundaryMargin, boolean isDp) {
  mYearWv.setTextBoundaryMargin(textBoundaryMargin, isDp);
  mMonthWv.setTextBoundaryMargin(textBoundaryMargin, isDp);
  mDayWv.setTextBoundaryMargin(textBoundaryMargin, isDp);
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置弯曲(3D)效果左右圆弧效果方向
 *
 * @param curvedArcDirection 左右圆弧效果方向
 *                           {@link WheelView#CURVED_ARC_DIRECTION_LEFT}
 *                           {@link WheelView#CURVED_ARC_DIRECTION_CENTER}
 *                           {@link WheelView#CURVED_ARC_DIRECTION_RIGHT}
 */
public void setCurvedArcDirection(@WheelView.CurvedArcDirection int curvedArcDirection) {
  mYearWv.setCurvedArcDirection(curvedArcDirection);
  mMonthWv.setCurvedArcDirection(curvedArcDirection);
  mDayWv.setCurvedArcDirection(curvedArcDirection);
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置弯曲(3D)效果左右圆弧偏移效果方向系数
 *
 * @param curvedArcDirectionFactor 左右圆弧偏移效果方向系数
 *                                 range 0.0-1.0 越大越明显
 */
public void setCurvedArcDirectionFactor(@FloatRange(from = 0.0f, to = 1.0f) float curvedArcDirectionFactor) {
  mYearWv.setCurvedArcDirectionFactor(curvedArcDirectionFactor);
  mMonthWv.setCurvedArcDirectionFactor(curvedArcDirectionFactor);
  mDayWv.setCurvedArcDirectionFactor(curvedArcDirectionFactor);
}

代码示例来源:origin: zyyoona7/WheelPicker

public DatePickerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  LayoutInflater.from(context).inflate(R.layout.layout_date_picker_view, this);
  mYearWv = findViewById(R.id.wv_year);
  mMonthWv = findViewById(R.id.wv_month);
  mDayWv = findViewById(R.id.wv_day);
  mYearWv.setOnItemSelectedListener(this);
  mMonthWv.setOnItemSelectedListener(this);
  mDayWv.setOnItemSelectedListener(this);
  mYearTv = findViewById(R.id.tv_year);
  mMonthTv = findViewById(R.id.tv_month);
  mDayTv = findViewById(R.id.tv_day);
}

代码示例来源:origin: zyyoona7/WheelPicker

@Override
public void onItemSelected(WheelView<Integer> wheelView, Integer data, int position) {
  if (wheelView.getId() == R.id.wv_year) {
    //年份选中
    mDayWv.setYear(data);
  } else if (wheelView.getId() == R.id.wv_month) {
    //月份选中
    mDayWv.setMonth(data);
  }
  int year = mYearWv.getSelectedYear();
  int month = mMonthWv.getSelectedMonth();
  int day = mDayWv.getSelectedDay();
  String date = year + "-" + month + "-" + day;
  if (mOnDateSelectedListener != null) {
    try {
      Date formatDate = null;
      //全部显示的时候才会返回转换后的日期
      if (mYearWv.getVisibility() == VISIBLE && mMonthWv.getVisibility() == VISIBLE && mDayWv.getVisibility() == VISIBLE) {
        formatDate = SDF.parse(date);
      }
      mOnDateSelectedListener.onDateSelected(this, year, month, day, formatDate);
    } catch (ParseException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置是否自动调整字体大小,以显示完全
 *
 * @param isAutoFitTextSize 是否自动调整字体大小
 */
public void setAutoFitTextSize(boolean isAutoFitTextSize) {
  mYearWv.setAutoFitTextSize(isAutoFitTextSize);
  mMonthWv.setAutoFitTextSize(isAutoFitTextSize);
  mDayWv.setAutoFitTextSize(isAutoFitTextSize);
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置WheelView 是否开启弯曲效果
 *
 * @param isCurved 是否开启
 */
public void setCurved(boolean isCurved) {
  mYearWv.setCurved(isCurved);
  mMonthWv.setCurved(isCurved);
  mDayWv.setCurved(isCurved);
}

代码示例来源:origin: zyyoona7/WheelPicker

/**
 * 设置选中条目折射偏移比例
 *
 * @param curvedRefractRatio 折射偏移比例 range 0.0-1.0
 */
public void setCurvedRefractRatio(@FloatRange(from = 0.0f, to = 1.0f) float curvedRefractRatio) {
  mYearWv.setCurvedRefractRatio(curvedRefractRatio);
  mMonthWv.setCurvedRefractRatio(curvedRefractRatio);
  mDayWv.setCurvedRefractRatio(curvedRefractRatio);
}

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