you can resolve it easily to make the layout like this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/recycler_view_item_background_color">
<!-- Red layout-->
<LinearLayout
android:id="@+id/red_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/item_performance_list_padding"
android:orientation="vertical">
<TextView
android:id="@+id/performance_date_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""/>
</LinearLayout>
<!-- Blue Layout-->
<LinearLayout
android:id="@+id/blue_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/text_item_divider" />
</LinearLayout>
you can show or hide the blue layout for every item according to your need.
LinearLayout blueLayout = (LinearLayout) findViewById(R.id.blue_layout);
blueLayout.setVisibility(View.GONE); // hide
blueLayout.setVisibility(View.VISIBLE); // show