android picker hide upper and lower value

喜欢而已 提交于 2019-12-12 04:35:12

问题


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

it disply random picker how to hide previous one and next one value/string?


回答1:


Unfortunately I find out there is no way to do it so... For them who want alternate solution.... I applied Viewpager instead of number picker to make it vertical i tried link and applied Onpagechangelistner. Simply done...

Sorry for those who are looking for solve issue For Numbericker!!



来源:https://stackoverflow.com/questions/43004336/android-picker-hide-upper-and-lower-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!