本文介绍了Android Picker隐藏上限值和下限值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 pickerhow to hide previous one and next one value/string?

推荐答案

不幸的是,我发现没有办法这样做...对于那些想要替代解决方案的人.我尝试使用Viewpager而不是数字选择器使它垂直,我尝试链接并应用了Onpagechangelistner.简单地完成...

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...

对那些正在为Numbericker寻找解决问题的人表示抱歉!

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

这篇关于Android Picker隐藏上限值和下限值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:17