单选的RecyclerView列表的Adapter

BaseQuickAdapter来自于BaseRecyclerViewAdapterHelper

public class TwoSelectGroupBean {
    private String name;
    private boolean isShwo;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isShwo() {
        return isShwo;
    }

    public void setShwo(boolean shwo) {
        isShwo = shwo;
    }
}



public class TwoSelectTaskGroupAdapter extends BaseQuickAdapter {
    private int position = -1;
    List data;
    public TwoSelectTaskGroupAdapter(List data) {
        super(R.layout.item_two_select_task_group,data);
        this.data = data;
    }

    @Override
    protected void convert(BaseViewHolder helper, TwoSelectGroupBean item) {
        boolean isShow = false;
        helper.setText(R.id.item_two_task_group_name,item.getName());
        ImageView img = (ImageView) helper.getConvertView().findViewById(R.id.item_two_task_group_img);
        ImageView del = (ImageView) helper.getConvertView().findViewById(R.id.item_two_task_group_del);
        RelativeLayout layout = (RelativeLayout) helper.getConvertView().findViewById(R.id.item_two_task_group_layout);
        if(item.isShwo()){
            img.setVisibility(View.VISIBLE);
        }else {
            img.setVisibility(View.GONE);
        }
        layout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(position == -1){
                    LogUtil.e("执行了:position = -1");
                    for(int x = 0;x

你可能感兴趣的:(单选的RecyclerView列表的Adapter)