RecyclerView 自适应高度

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010369338/article/details/78844905

网上找了三四种方法都效果都不怎么理想。
这个方法亲测可行(LinearLayoutManager Vertical,其他的没试)

在Adapter的`onBindViewHolder`方法种使用。
ViewGroup.LayoutParams layoutParams = holder.itemView.getLayoutParams();
        layoutParams.height = RelativeLayout.LayoutParams.WRAP_CONTENT;
        holder.itemView.setLayoutParams(layoutParams);

猜你喜欢

转载自blog.csdn.net/u010369338/article/details/78844905