0

I want to make expandable recycler view with dynamic no of item. I need same recycler view as imagur comment section for each image. How to add that dynamic no of childern view in row of recyclerview.

Thank you

user3606902
  • 829
  • 1
  • 10
  • 25

1 Answers1

1

I asked similar question but no one answer so i searched and find a way. you can define a layout for your view and inflate it programmatically. it's not against preferences in Android. So inflate your layout using LayoutInflater :

    LayoutInflater inflater = LayoutInflater.from(context);
    View inflatedLayout= inflater.inflate(R.layout.yourLayout, null, false);
    yourParentView.addView(inflatedLayout);

"yourParentView" is the Relative or Linear Layout. don't forget to add this LayoutInflater in your "onBindViewHolder". hope this work.

Mohammad Fatemi
  • 1,278
  • 2
  • 12
  • 16