适配器可以向NumberPicker提供内容吗?

时间:2015-12-31 01:23:11

标签: android

valuepicker = (NumberPicker) findViewById(R.id.valuepicker);
        String[] city = {"city1","city2","city3","city3","city4","city4"};
        valuepicker.setDisplayedValues(city);
        valuepicker.setMinValue(0);
        valuepicker.setMaxValue(city.length - 1);
        valuepicker.setValue(4);

城市可以通过适配器提供吗? 怎么样?

1 个答案:

答案 0 :(得分:0)

NumberPicker扩展LinearLayout,因此您无法使用Adapter,但您可以为其显示一系列字符串,以setDisplayedValues显示。< / p>