多布局代理, new MultiTypeDelegate
tysheng opened this issue · 41 comments
更便捷的多布局, 为 BaseQuickAdapter
设置代理
public class MultiDelegateAdapter extends BaseQuickAdapter<Entity, BaseViewHolder> {
public MultiDelegateAdapter() {
super(null);
//Step.1
setMultiTypeDelegate(new MultiTypeDelegate<Entity>() {
@Override
protected int getItemType(Entity entity) {
//根据你的实体类来判断布局类型
return entity.type;
}
});
//Step.2
getMultiTypeDelegate()
.registerItemType(Entity.TEXT, R.layout.item_text_view)
.registerItemType(Entity.IMG, R.layout.item_image_view);
}
@Override
protected void convert(BaseViewHolder helper, Entity entity) {
//Step.3
switch (helper.getItemViewType()) {
case Entity.TEXT:
// do something
break;
case Entity.IMG:
// do something
break;
}
}
}
多布局代理很简单,在任何继承与BaseQuickAdapter
的 adapter 上都可以实现,分为三步,如下:
Step.1
setMultiTypeDelegate()
, 并重写getItemType()
方法
需要说明的是Entity 并不需要实现任何接口 ,只需要能够判断出该实体对应的是哪个布局类型即可
Step.2
getMultiTypeDelegate().registerItemType()
设置每种type对应的布局
Step.3
- 分 type 进行
convert()
操作
OK, 多布局就可以顺利的运行了
Make it easier for multi type situation, set a delegate for BaseQuickAdapter
public class MultiDelegateAdapter extends BaseQuickAdapter<Entity, BaseViewHolder> {
public MultiDelegateAdapter() {
super(null);
//Step.1
setMultiTypeDelegate(new MultiTypeDelegate<Entity>() {
@Override
protected int getItemType(Entity entity) {
//infer the type by entity
return entity.type;
}
});
//Step.2
getMultiTypeDelegate()
.registerItemType(Entity.TEXT, R.layout.item_text_view)
.registerItemType(Entity.IMG, R.layout.item_image_view);
}
@Override
protected void convert(BaseViewHolder helper, Entity entity) {
//Step.3
switch (helper.getItemViewType()) {
case Entity.TEXT:
// do something
break;
case Entity.IMG:
// do something
break;
}
}
}
First, make you adapter extends BaseQuickAdapter
, then achieve the following steps :
Step.1
setMultiTypeDelegate()
, and overridegetItemType()
Notice that there is no need for Entity to implement any interface , only for inferring which layout type is.
Step.2
getMultiTypeDelegate().registerItemType()
, set layout id for every type.
Step.3
- do
convert()
job for every type.
That's all.
compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.6'
return entity.type; 请问这里的entity.type是返回的什么呢?
你自己写的,区分type
我的实体类使用的Retrifot添加Gson转换器直接存入实体类了,可以说下采用代理的话,实体类里面怎么写呢,小白一枚。我现在安装这样写出来,RecyclerView空白。
有四种布局,但是只有两个bean,外面套一个类,应该怎么套呢,小白求大神指导。。。。
recyclerview 嵌套recyclerview 报android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1048) 这种错误,是由于什么引起的,求解决!
@chaoDream 重新开个issue提问
没感觉这个委托的写法比原来的好啊
@zouzhenglu 解决了和实体类耦合的问题 这样就不需要强制去实现MultiItemEntity接口
那其实重写他的getItemType就可以了,这样啊还清晰点
有一个疑问:这种代理情况是在哪里设置list数据集? 构造方法没有参数传入
请问想根据行号设置布局可以做得到吗
在哪里传数据
构造方法内调用setnewdata 或者 修改构造方法参数不传null,传单参数你的list
适配器进行 addFooterView(view) view不能有listview、Gridview、Recyclerview吗?我这边添加了不显示数据。
这个多布局可以求一个简单的demo吗?
android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2774)
at android.content.res.Resources.getLayout(Resources.java:1165)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1478)
at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:989)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:985)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:762)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at com.scwang.smartrefresh.layout.impl.RefreshContentWrapper.layout(RefreshContentWrapper.java:206)
at com.scwang.smartrefresh.layout.SmartRefreshLayout.onLayout(SmartRefreshLayout.java:690)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1172)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java
会出现这种问题,怎么解决?
我四种布局四个接口,好像用这个实现不了
你好 我使用多布局时没有回调MultiTypeDelegate中的getItemType方法 数据是有的
android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c 是什么原因啊,老铁??
@SuperKe 布局类型找不到。检查一下代码
在ItemProvider中如何处理子View的点击事件呢
可以根据position来返回不同的布局类型吗
那其实重写他的getItemType就可以了,这样啊还清晰点
这个解耦还是有好处的,比如你要抽象的一个方法里有BaseQuickAdapter 他和Mulit不是一个类型,就得写两套
其实跟重写getDefItemType()也可以有一样的效果吧。就继承BaseQuickAdapter.
android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2774)
at android.content.res.Resources.getLayout(Resources.java:1165)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1478)
at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:989)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:985)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:762)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at com.scwang.smartrefresh.layout.impl.RefreshContentWrapper.layout(RefreshContentWrapper.java:206)
at com.scwang.smartrefresh.layout.SmartRefreshLayout.onLayout(SmartRefreshLayout.java:690)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1172)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java会出现这种问题,怎么解决?
我也出现这个问题
android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2774)
at android.content.res.Resources.getLayout(Resources.java:1165)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1478)
at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:989)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:985)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:762)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at com.scwang.smartrefresh.layout.impl.RefreshContentWrapper.layout(RefreshContentWrapper.java:206)
at com.scwang.smartrefresh.layout.SmartRefreshLayout.onLayout(SmartRefreshLayout.java:690)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1172)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java会出现这种问题,怎么解决?
后来怎么解决了?
@RUANHAOANDROID 多布局情况??
你瞅瞅你是不是getViewType Bean类里面多返回了一个参数
譬如返回的0
但是 你的adapter没有对0进行操作
@RUANHAOANDROID 多布局情况??
你瞅瞅你是不是getViewType Bean类里面多返回了一个参数
譬如返回的0
但是 你的adapter没有对0进行操作
正如你所说,我得到了解决,谢谢
多item使用时,recyclerview滑动时会卡顿。
recyclerview 嵌套recyclerview 报android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1048) 这种错误,是由于什么引起的,求解决!
android.content.res.Resources$NotFoundException: Resource ID #0xfffffe6c
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2774)
at android.content.res.Resources.getLayout(Resources.java:1165)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.chad.library.adapter.base.BaseQuickAdapter.getItemView(BaseQuickAdapter.java:1478)
at com.chad.library.adapter.base.BaseQuickAdapter.createBaseViewHolder(BaseQuickAdapter.java:989)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateDefViewHolder(BaseQuickAdapter.java:985)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:762)
at com.chad.library.adapter.base.BaseQuickAdapter.onCreateViewHolder(BaseQuickAdapter.java:68)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:6519)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5706)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5589)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5585)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2231)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1558)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1518)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:610)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3719)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3436)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3988)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at com.scwang.smartrefresh.layout.impl.RefreshContentWrapper.layout(RefreshContentWrapper.java:206)
at com.scwang.smartrefresh.layout.SmartRefreshLayout.onLayout(SmartRefreshLayout.java:690)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1172)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java会出现这种问题,怎么解决?
实体类继承了MultiItemEntity,其中getItemType的返回值你应该返回的是0,正常应该返回itemType
你gson解析完了有几个实体类呢?外边在套一个类 2017年6月14日 22:37,"DaiFalin" notifications@github.com写道:
…
我的实体类使用的Retrifot添加Gson转换器直接存入实体类了,可以说下采用代理的话,实体类里面怎么写呢,小白一枚。 我现在安装这样写出来,RecyclerView空白。 — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <#968 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALW_S2UsVqB9HkwEL28gbKI963rN40yuks5sD_BDgaJpZM4M1D2B .
大佬 你解决了吗?
在使用多布局的时候adapter?.setNewData(it),it不是list怎么设置data
最新版50,setMultiTypeDelegate()这个方法是不是取消了?
@jackyHuangH
2.9.50 上使用 MultipleItemRvAdapter 代替 BaseQuickAdapter。
后面的版本应该会加回来这个函数。
@RUANHAOANDROID 多布局情况??
你瞅瞅你是不是getViewType Bean类里面多返回了一个参数
譬如返回的0
但是 你的adapter没有对0进行操作正如你所说,我得到了解决,谢谢
怎么解决的亲?
请问如何根据item的类型来初始化不同布局,这种只能一个holder对应一个布局,如果是聊天列表我想根据item是发送方还是接收方来实例化不同layout的布局 该如何实现