I implemented an expandable recyclerview with child elements that are part of the list. I followed this code. This is how it works,
The implementation of
change the layout manager to gridlayout manager and handle the span size as mentioned below
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
int type=mAdapter.getItemViewType(position);
if (type == "view holder type name")
return 2;
else
return 1;
}
});