作者kyand4010 (Eric)
看板AndroidDev
标题显示checkbox多选
时间Wed Mar 7 18:13:45 2018
private class inputlistviewadapter extends BaseAdapter {
private Activity inActivity;
private List<inputlistview> inputlistview_list;
private inputlistviewadapter(Activity activity, List<inputlistview> in
putlistview) {
super();
this.inActivity = activity;
this.inputlistview_list = inputlistview;
}
@Override
public int getCount() {
return inputlistview_list.size();
}
@Override
public Object getItem(int position) {
return inputlistview_list.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup pa
rent) {
if (convertView == null) {
LayoutInflater inflater = inActivity.getLayoutInflater();
convertView = inflater.inflate(R.layout.main_row, null);
}
TextView a = convertView.findViewById(R.id.textView5);
TextView b = convertView.findViewById(R.id.textView6);
final CheckBox checkBox = convertView.findViewById(R.id.checkBox);
a.setText(inputlistview_list.get(position).getTextView5());
b.setText(inputlistview_list.get(position).getTextView6());
if (editmode) {
checkBox.setVisibility(View.VISIBLE);
} else {
checkBox.setVisibility(View.GONE);
}
// checkBox.setText(inputlistview_list.get(position).toString());
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChan
geListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean
isChecked) {
if (checkBox.isChecked()==true){
}
}
});
return convertView;
}
}
}
请问一下要怎麽下手写
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 114.136.103.44
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1520417628.A.5D1.html
※ 编辑: kyand4010 (110.28.75.158), 03/07/2018 18:27:20
1F:推 t52101t: 1.请讲清楚你的问题/哪里不会 2.找个code分享网站贴code 03/08 14:08
2F:→ t52101t: 3.文章分类... 你这篇真让人痛苦 03/08 14:09
3F:推 evo1994: 写interface callback回activity 03/08 22:22