在从列表视图中的行检查复选框时,也会选择其他几个复选框。 (在android中)。有谁知道为什么会出现这个问题?这是我的源代码:
dbHelper db1 = new dbHelper(WaterPopup.this);
waterList = new ArrayList<HashMap<String, Object>>();
map1 = new HashMap<String, Object>();
Cursor c1 = db1.getMenuDetailsData(SubMenuID);
c1.moveToFirst();
while (c1.isAfterLast() == false) {
if (c1.getString(3).substring(0).equals("I")) {
map1.put("WaterOptionID", c1.getString(5).substring(0)) ;
map1.put("CheckBox",cb);
map1.put("WaterOptionName", c1.getString(0).substring(0));
map1.put("MinusImg",R.drawable.minus_30+"");
map1.put("Quantity","1");
map1.put("PlusImg",R.drawable.plus_30+"");
map1.put("Currency","$");
map1.put("Price", c1.getString(2).substring(0));
map1.put("OrderStatusImg",R.drawable.round_25+"");
waterList.add(map1);
map1 = new HashMap<String, Object>();
}
c1.moveToNext();
}
c1.close();
mSchedule = new SimpleAdapter(WaterPopup.this, waterList, R.layout.waterlistitem,
new String[] {"WaterOptionID","CheckBox", "WaterOptionName", "MinusImg", "Quantity","PlusImg","Currency", "Price", "OrderStatusImg"},
new int[] {R.id.wateroptionID_tv,R.id.orderWater_cb, R.id.wateroptionName_tv, R.id.minussign_btn, R.id.Qty_tv, R.id.plusimage_btn,R.id.currency_tv,R.id.price_tv,R.id.orderStatus_btn});
OrderWaterItem.setAdapter(mSchedule);
答案 0 :(得分:0)
SimpleAdapter仅支持TextViews:
构造函数中'to'参数的描述:
“应该在”from“参数中显示列的视图。这些应该都是TextViews 。此列表中的前N个视图将被赋予前N列的值from参数。“
答案 1 :(得分:0)