我在列表视图中显示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);
}
感谢您的帮助