ListView与Numberpicker

时间:2015-08-31 11:18:31

标签: android listview numberpicker

我在列表视图中显示Numberpicker时遇到问题:

Numberpicker存在于布局list_item

 protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    context=this;
    records=new ArrayList<Product>();
    listProduct=(ListView)findViewById(R.id.product_list);
    adapter=new CustomAdapter(context, R.layout.list_item,R.id.pro_name, records);
    listProduct.setAdapter(adapter);

    NumberPicker np = (NumberPicker) findViewById(R.id.numberPicker2);
    String[] nums = new String[20];
    for(int i=0; i<nums.length; i++)
        nums[i] = Integer.toString(i);
    np.setMinValue(1);
    np.setMaxValue(20);
    np.setWrapSelectorWheel(false);
    np.setValue(1);
    }

感谢您的帮助

0 个答案:

没有答案