I did not implement RecyclerView , but I replicated two lines in a linear layout, minus the padding from the original question:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:background="#303030" android:id="@+id/cv1" card_view:cardElevation="5dp" android:foreground="?android:attr/selectableItemBackground" xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout android:layout_width="match_parent" android:layout_height="80dp" android:layout_margin="4dp" android:longClickable="true" android:background="#303030"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/person_photo" android:background="@drawable/vector_red" android:layout_alignBottom="@+id/txtSub" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Large Text" android:id="@+id/txtMain" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/person_photo" android:layout_toEndOf="@+id/person_photo" android:elevation="4dp" android:textSize="20dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Small Text" android:id="@+id/txtSub" android:layout_below="@+id/txtMain" android:layout_toRightOf="@+id/person_photo" android:layout_toEndOf="@+id/person_photo" /> </RelativeLayout> </android.support.v7.widget.CardView> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:background="#303030" android:id="@+id/cv1" card_view:cardElevation="5dp" android:foreground="?android:attr/selectableItemBackground" xmlns:android="http://schemas.android.com/apk/res/android"> <RelativeLayout android:layout_width="match_parent" android:layout_height="80dp" android:layout_margin="4dp" android:longClickable="true" android:background="#303030"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/person_photo" android:background="@drawable/vector_red" android:layout_alignBottom="@+id/txtSub" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Large Text" android:id="@+id/txtMain" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/person_photo" android:layout_toEndOf="@+id/person_photo" android:elevation="4dp" android:textSize="20dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceSmall" android:text="Small Text" android:id="@+id/txtSub" android:layout_below="@+id/txtMain" android:layout_toRightOf="@+id/person_photo" android:layout_toEndOf="@+id/person_photo" /> </RelativeLayout> </android.support.v7.widget.CardView> </LinearLayout>
Play with the expansion and you will get the best results. You can also try adding background color to your map, then you can get rid of the layout fields in your RelativeLayout!
source share