我在我的应用程序中使用列表项。我正在使用适配器:
adapter adapter = new ArrayAdapter<Settingsmodel>(this,
                android.R.layout.simple_list_item_checked, listItems);
在那我想手动检查所选列表项的刻度线。我搜索了很多。找不到办法。如果有人知道,请帮助我。
我在我的应用程序中使用列表项。我正在使用适配器:
adapter adapter = new ArrayAdapter<Settingsmodel>(this,
                android.R.layout.simple_list_item_checked, listItems);
在那我想手动检查所选列表项的刻度线。我搜索了很多。找不到办法。如果有人知道,请帮助我。
每次单击 CustomAdapter 中的复选框时,您都可以使用列表并添加标签。
CheckBox chkbox= (CheckBox)view.findViewById(R.id.checkBox1);
            chkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(
                        CompoundButton buttonView, boolean isChecked) {
                    isSelected.set(position, isChecked);
                }
            });
Where isSelected is     private List<Boolean> isSelected= new ArrayList<Boolean>();
您可以通过分析 isSelected 列表在以下 while 循环中完成所有工作
while(isSelected.contains(true))
            {
                int pos=isSelected.indexOf(true);
                isSelected.set(pos, false);
                sendMail.add(listMap.get(pos).get("email"));
                //                  if(listMap.get(pos).get("email_2")!=null){
                //                      sendMail.add(listMap.get(pos).get("email_2"));
                //                  }
                //                  if(listMap.get(pos).get("email_3")!=null){
                //                      sendMail.add(listMap.get(pos).get("email_3"));
                //                  }
            }
    创建自己的适配器....
public class SettingsmodelAdapter extends ArrayAdapter<Settingsmodel>
{
    .....
    public final View getView(final int position, final View convertView, final ViewGroup parent)
    {
        final View row = super.getView(position, convertView, parent);
        final CheckBox checkBox = (CheckBox) row.findViewById(android.R.id.checkbox);
        checkBox.setChecked(your value);
        .....
    }
    .....
}