numberPicker1= (NumberPicker) findViewById(R.id.numberPicker1);
final String genders[] = { "red", "blue", "green"};
numberPicker1.setMinValue(0);
numberPicker1.setMaxValue(genders.length - 1);
numberPicker1.setDisplayedValues(genders);
numberPicker1.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);;
NumberPicker.OnValueChangeListener myValChangedListener = new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
Toast.makeText(MainActivity.this,
"Value: " + genders[newVal], Toast.LENGTH_LONG).show();
}
};
它显示随机选择器 如何隐藏上一个和下一个值/字符串?
答案 0 :(得分:1)
不幸的是我发现没有办法这样做...... 对于想要替代解决方案的人.... 我应用了Viewpager而不是数字选择器使其垂直,我尝试了link并应用了Onpagechangelistner。 干得好......
很抱歉那些正在寻找解决问题的人为Numbericker !!