看起来像某些版本的android上的NumberPicker返回错误的结果。
例如,我有:
显示的值= {" 3"," 5"," 10"," 15"," 30",& #34; 60" }
实际值= {0,1,2,3,4,5} //由android设置
如果我选择显示值" 15",我希望得到numberPicker.getValue()= 3.但在某些设备上我得到15(Acer Liquid E2 Duo(rooted),Android 4.2.2)。
有没有办法获得所选值的索引?或者获取Number Picker的实际值列表?
String[] stringTimerInterval = { "3", "5", "10", "15", "30", "60" }
npTimer.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
npTimer.setMaxValue(5);
npTimer.setMinValue(0);
npTimer.setValue(interval);
npTimer.setDisplayedValues(stringTimerInterval);
npTimer.setWrapSelectorWheel(false);