Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用DatePicker年份总是跳到positio为0的位置 #51

Open
rainfoam opened this issue Apr 26, 2024 · 0 comments
Open

使用DatePicker年份总是跳到positio为0的位置 #51

rainfoam opened this issue Apr 26, 2024 · 0 comments

Comments

@rainfoam
Copy link

如果大家也碰到这个问题,下面是一个解决办法,让大家少走弯路:

//项目中的代码:
//时间区间(需求:1年前1月1号->今天)

  val nowCalendar = Calendar.getInstance()
  val mixCalendar = Calendar.getInstance()
  mixCalendar.add(Calendar.YEAR, -1)
  mixCalendar.set(Calendar.MONTH, Calendar.JANUARY)
  mixCalendar.set(Calendar.DAY_OF_MONTH, 1)
  setYearRange(mixCalendar.get(Calendar.YEAR),nowCalendar.get(Calendar.YEAR)) 
  setSelectedDate(nowCalendar)
  setDateRange(mixCalendar, nowCalendar, WheelView.OverRangeMode.HIDE_ITEM)   //关键就是上面二行代码要放在setRange之前
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant