Help.I需要在recyclerView.And中的水平RecyclerView,在某些项目中,我需要它;
protected void convert(BaseViewHolder helper, DynamicsModel item) {
RecyclerView recyclerView = helper.getView(R.id.rvCommentImg);
if (item.getImg_urls() != null) { //if img not null
recyclerView.setVisibility(View.VISIBLE);
String[] a = item.getImg_urls().split(",");
List<String> imgs = new ArrayList<>();
Collections.addAll(imgs, a);
setCommentImgs(recyclerView, imgs);
}else { //if none img ,GONE the recyclerView
recyclerView.setVisibility(View.GONE);
}
break;
}
};
它可以工作,并显示图像。但是当内部的recyclerView消失了,它的物品高度没有变化。我想要一个多项高度...
答案 0 :(得分:0)
谢谢,我使用MultiTypeItem来解决BrvahAdapter的问题;
public DynamicsAdapter(List<DynamicsModel> data, boolean isMyDynamics) {
super(data);
addItemType(Constants.SHARE_VIDEO, R.layout.dynamics_share_video);
addItemType(Constants.SHARE_GAIN, R.layout.dynamics_share_gain);
this.isMyDynamics = isMyDynamics;
}
@Override
protected void convert(BaseViewHolder helper, final DynamicsModel item) {
helper.setText(R.id.tvDynamicsDate, formatData);
switch (helper.getItemViewType()) {
case Constants.SHARE_VIDEO: //todo in R.layout.dynamics_share_video
break;
case Constants.SHARE_GAIN://todo in R.layout.dynamics_share_gain
break;
}
}