解决recycleView嵌套recycleView时内层rv添加item间距,刷新时item间距增大

item间距增大的原因是重复addItemDecoration了,所以addItemDecoration时判断一下(viewHolder.rvGuessItem为recycleView)

if(viewHolder.rvGuessItem.getTag(viewHolder.rvGuessItem.getId())!=null&&viewHolder.rvGuessItem.getTag(viewHolder.rvGuessItem.getId()).equals("addedDecoration")){

}else{

viewHolder.rvGuessItem.addItemDecoration(newLinerItemDecoration(10,0));//设置item间距

viewHolder.rvGuessItem.setTag(viewHolder.rvGuessItem.getId(),"addedDecoration");

}

你可能感兴趣的:(解决recycleView嵌套recycleView时内层rv添加item间距,刷新时item间距增大)