设置selectedItemPosition不起作用
yecaler opened this issue · 1 comments
yecaler commented
如下代码设置,选择项没有选中到当前秒上,请问如何解决?
for (i in 0..59) {
minutelist.add(i)
}
dataBinding!!.pickerSecond.data = minutelist
dataBinding!!.pickerSecond.selectedItemPosition = TimeUtils.getNowDate().seconds
yecaler commented
dataBinding!!.pickerSecond.setSelectedItemPosition(TimeUtils.getNowDate().seconds, false)
已解决。需要设置setSelectedItemPosition(TimeUtils.getNowDate().seconds, false)