listview checkbox多選

看板AndroidDev作者 (Eric)時間6年前 (2018/03/07 18:13), 6年前編輯推噓2(201)
留言3則, 2人參與, 6年前最新討論串1/1
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://www.ptt.cc/bbs/AndroidDev/M.1520417628.A.5D1.html ※ 編輯: kyand4010 (110.28.75.158), 03/07/2018 18:27:20

03/08 14:08, 6年前 , 1F
1.請講清楚你的問題/哪裡不會 2.找個code分享網站貼code
03/08 14:08, 1F

03/08 14:09, 6年前 , 2F
3.文章分類... 你這篇真讓人痛苦
03/08 14:09, 2F

03/08 22:22, 6年前 , 3F
寫interface callback回activity
03/08 22:22, 3F
文章代碼(AID): #1QdxjSNH (AndroidDev)
文章代碼(AID): #1QdxjSNH (AndroidDev)