youlookwhat / ByRecyclerView

🔥 RecyclerView 下拉刷新、上拉松手/自动加载更多、item点击/长按、item局部刷新、头布局/尾布局/状态布局、万能分割线、Skeleton骨架图、极简adapter、嵌套滑动置顶
https://youlookwhat.github.io/ByRecyclerView
Apache License 2.0
798 stars 139 forks source link

多类型不能使用databing吗? #76

Closed zs18340282344 closed 5 months ago

youlookwhat commented 9 months ago

可以使用的,在ViewHolder里使用,像这样:

private static class ViewHolder extends BaseBindingHolder<DataItemBean, ItemHomeBinding> {
    ViewHolder(ViewGroup viewGroup, int layoutId) {
        super(viewGroup, layoutId);
    }

    @Override
    protected void onBindingView(BaseBindingHolder holder, DataItemBean bean, int position) {
        binding.tvText.setText(bean.getDes() + "-" + position);
    }
}

外面还是正常的,具体:https://github.com/youlookwhat/ByRecyclerView/blob/master/app/src/main/java/me/jingbin/byrecyclerview/adapter/MultiAdapter.java