Skip to content

zhouxianyu/MultiSelectList

Repository files navigation

MultiSelectList

效果图

about-gif

如何使用

  1. 创建Model继承MultiSelectNode
public class SellerViewModel extends MultiSelectNode<SellerViewModel>{

    public SellerViewModel(String text,int viewType) {
        super(viewType);
        this.text = text;
    }

    private String text;

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}
  1. 创建Adapter继承MultiSelectAdapter,复写Adapter的onCreateViewHolder与onBindViewHolder方法

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == 0 || viewType == 1) {
            return new TitleViewHolder(parent);
        } else if (viewType == 2) {
            return new ItemViewHolder(parent);
        }
        return null;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        final SellerViewModel item = getItem(position);
        if (holder instanceof ItemViewBinder) {
            ((ItemViewBinder) holder).bindView(item);
        }
    }

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages