I'm trying to create a mixed items in a RecyclerView parent, within it, contains some CardViews with another RecyclerView inside it. If you can't see it yet, imagine several ListViews inside a RecyclerView (with the ListViews being grouped by a Header).
Here is a structure that I've drawn to make it more clear:

Above is the layout structure that I'm trying to achieve. Please note that this is only the planning. I'm not sure if it is a good idea to have a RecyclerView within a RecyclerView.
So far, I've tried using ExpandableRecyclerView to achieve this kind of complex layout. But the problem is when adding a different item type in the RecyclerView (eg. a horizontal scroll carousel), it is hidden within the Header.
I can't think of any other ways now. Do you guys have any suggestions on how to achieve this layout?
To make it simple, it is a sectioned RecyclerView within a child CardView inside a RecyclerView parent, if you understand what I mean.
Having a RecyclerView within another RecyclerView is discouraged. However if you want to achieve the above using nested RecyclerViews, you can use a layout manager that wraps the RecyclerView to its content's height for the innermost (Green Coloured) RecyclerView. There is one such layout manager already available at https://github.com/serso/android-linear-layout-manager
Also make sure to disable touch gestures on the innermost RecyclerView by setting an onTouchListener as follows.
mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener {
    @Override
    public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
        return true;
    }
    @Override
    public void onTouchEvent(RecyclerView rv, MotionEvent e) {
    }
    @Override
    public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
    }
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With