这是我的代码
np = (NumberPicker) findViewById(R.id.picker);
np.setMaxValue(9);
np.setValue(5);
np.setMinValue(1);
选择器可以查看 Char 吗? 数量=查看
最佳答案
只需使用NumberPicker#setDisplayedValues()
,setMinValue
和setMaxValue
对应于数组索引:
NumberPicker np = (NumberPicker) findViewById(R.id.picker);
np.setMinValue(0);
np.setMaxValue(8);
np.setDisplayedValues(new String[] { "A+", "A", "B+", "B", "C+", "C", "D+", "D", "F"});
关于java - Android ,我可以将 NumberPicker 更改为 CharPicker {A+,A,B+,B.C+,C,D+,D,F},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22281271/