Skip to content Skip to sidebar Skip to footer

Create Cardview With Dynamic Custom List Inside

I create a RecyclerView with CardViews in my app. Now I want to add inside each CardView a new List of custom Views, with a custom layout (see example Image). When the add button i

Solution 1:

What I would do is attached a click handler to the Views is your ViewHolder. In this event handler you can delegate to a presenter of some sort that will add/remove/edit the View in the card holder.

 private class MyHolder extends ViewHolder 
        implements View.OnClickListener {
    ...

    public MyHolder(View itemView, MyPresenter presenter) {
        super(itemView);
        itemView.setOnClickListener(this);

        ...
    }

    @Override
    public void onClick(View v) {
        presenter.addRow(v);
    }
}

Post a Comment for "Create Cardview With Dynamic Custom List Inside"