0
這是我如何使用適配器執行GridView,有人能告訴我如何修改這些代碼以獲得多項選擇效果?以下是我的代碼,懇請提供,並提供一千多謝謝。如何使用GridView android做多選?
//privateList<Condiment> CondimentList;
CondimentList = getCondimentDescription(productcode);
condimentGrid.setAdapter(new condimentlist());
public class condimentlist extends BaseAdapter {
LayoutInflater mInflater;
public condimentlist() {
mInflater = LayoutInflater.from(cart_list.this);
}
@Override
public int getCount() {
return CondimentList.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.condiment_item, null);
}
Condiment myObj = CondimentList.get(position);
Button CondimentItem = (Button) convertView.findViewById(R.id.condimentItem);
CondimentItem.setText("" +myObj.getCondimentDescription());
return convertView;
}
}
爲什麼不嘗試回收利用者的看法呢? –
看看這個http://www.grokkingandroid.com/statelistdrawables-for-recyclerview-selection/ –
如果我使用回收視圖有什麼不同? – user3463131