在adapter中的onBindViewHolder方法中增加以下两句代码完美解决
ViewGroup.LayoutParams layoutParams = viewHolder.itemView.getLayoutParams();
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
在adapter中的onBindViewHolder方法中增加以下两句代码完美解决
ViewGroup.LayoutParams layoutParams = viewHolder.itemView.getLayoutParams();
layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
本文标题:RecyclerView的item高度自适应
本文链接:https://www.haomeiwen.com/subject/zdjzrftx.html
网友评论