草庐IT

CompoundView

全部标签

Android - 在 RecyclerView 中重新创建自定义动态生成的复合 View ,导致性能不佳

我正在使用自定义CompoundView延伸LinearLayout显示RecyclerView的项目.每个项目显示一篇包含多个段落和图像的文章。CompoundView添加TextView或ImageView动态地基于CompoundView.setData(Listpieces)附加的数据,其中的数量在附加数据之前是未知的。每个DataPiece对象告诉CompoundView无论是一段文字还是一张图片。这是CompoundView.setData(Listpieces)的代码:publicvoidsetData(Listpieces){removeAllViews();for(D