arcadefire / nice-spinner

A nice spinner for Android
Apache License 2.0
2.84k stars 446 forks source link

当数据为1时产生的一个BUG #141

Open lulianqing opened 4 years ago

lulianqing commented 4 years ago

调用 nicespinner.attachDataSource(list),当list.size()=1时,nicespinner不会显示任何string

jordan32331 commented 4 years ago

可以通过手动调用setSelectedIndex这个方法来解决,但是这样操作的前提是你的list只能是String,如果是对象的话,这个方法会报类型转换异常。说到底还是库有问题

kcjian commented 4 years ago

@arcadefire Can you help solve this bug?

wyba commented 4 years ago

@arcadefire Can you help solve this bug?

只能添加一个一模一样的数据了

kcjian commented 4 years ago

@arcadefire Can you help solve this bug?

只能添加一个一模一样的数据了

我下载了源码改了一下,NiceSpinner.setAdapterInternal方法里的 if (adapter.getCount() > 0) 改为 if (adapter.getCount() >= 0)就没问题了,依赖本地代码了

wyba commented 4 years ago

setAdapterInternal

学习到了,大神^_^,哈哈哈