Android,我可以将NumberPicker更改为CharPicker {A +,A,B +,B.C +,C,D +,D,F}

时间:2014-03-09 10:49:56

标签: java android loops

这是我的代码

np = (NumberPicker) findViewById(R.id.picker);
np.setMaxValue(9);
np.setValue(5);
np.setMinValue(1);

可以选择查看Char吗? number =查看

1 个答案:

答案 0 :(得分:3)

只需使用NumberPicker#setDisplayedValues()setMinValuesetMaxValue对应于数组索引:

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"});