うまくいきました。小さな変更を加えたので、ここでコードを共有します。listalayout.xml には、各行に表示したいコンポーネント (numberPicker を含む) だけがあります。
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
// We came from the scanning activity; the return intent contains a RESULT_EXTRA key
// whose value is an ArrayList of BarcodeResult objects that we found while scanning.
// Get the list of objects and add them to our list view.
if (resultCode == RESULT_OK)
{
ArrayList<BarcodeResult> barcodes = data.getParcelableArrayListExtra(BarcodeScanActivity.RESULT_EXTRA);
if (barcodes != null)
{
for (int i =0;i<barcodes.size();i++)
{
bcResultArray.add(barcodes.get(i).barcodeString);
}
ListView barcodeList = (ListView) findViewById(R.id.listView1);
ListAdapter customAdapter = new MyXYZAdapter(this, R.layout.listalayout, bcResultArray);
barcodeList.setAdapter(customAdapter);
}
}
}
public class MyXYZAdapter extends ArrayAdapter<String> {
private final List<String> list;
public MyXYZAdapter(Context context, int resource, List<String> items) {
super(context, resource, items);
list = items;
}
//other stuff
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi;
vi = LayoutInflater.from(getContext());
v = vi.inflate(R.layout.listalayout, null);
}
TextView tv1 = (TextView) v.findViewById(R.id.lltitulo);
tv1.setText(list.get(position));
NumberPicker np = (NumberPicker) v.findViewById(R.id.numberPicker1);
np.setMaxValue(999);
np.setMinValue(0);
np.setValue(1);
return v;
}
//other stuff
}