Can I create views programmatically in a ViewHolder
instead of binding them from XML in the classic way as in all examples?
Also, my views need an image filepath in order to be created, how do I pass that to the ViewHolder
protected static class ImagePreviewViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public LinearLayout page;
public ImagePreviewViewHolder(View itemView) {
super(itemView);
page = createPage(filePath); // How do I pass the filepath?
}
}
Did u try create View itemView via code?
for ex.:
and