android 选择器隐藏上下值
android picker hide upper and lower value
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();
}
};
显示随机选择器
如何隐藏上一张和下一张value/string?
不幸的是,我发现没有办法做到这一点......
对于那些想要替代解决方案的人....
我应用了 Viewpager 而不是数字选择器来使其垂直我尝试了 link 并应用了 Onpagechangelistner。
简单完成...
抱歉那些正在为 Numbericker 寻找解决问题的人!!
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();
}
};
显示随机选择器 如何隐藏上一张和下一张value/string?
不幸的是,我发现没有办法做到这一点...... 对于那些想要替代解决方案的人.... 我应用了 Viewpager 而不是数字选择器来使其垂直我尝试了 link 并应用了 Onpagechangelistner。 简单完成...
抱歉那些正在为 Numbericker 寻找解决问题的人!!