I am developing app where I am using CardView with RecyclerView.
I want to reduce the space between two card items. Want to specify the width of cardview.(Don't want to set width to MATCH_PARENT)
below is my code -
I have done trying with card_view:cardMaxElevation="1dp"
, card_view:cardElevation="1dp"
and card_view:contentPadding="-8dp"
but this is not working for me.
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_marginTop="15dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"/>
Here is my cardview -
<android.support.v7.widget.CardView
android:id="@+id/companyNameCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginEnd="5dp"
card_view:cardPreventCornerOverlap="false"
card_view:cardBackgroundColor="@color/logo_yellow_light"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="3dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="8dp">
<RelativeLayout
android:id="@+id/mainCardRelative"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/full_transparent_color">
<RelativeLayout
android:id="@+id/thumbnailRelative"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_marginTop="5dp"
android:layout_marginStart="5dp"
android:background="@color/full_transparent_color">
<ImageView
android:id="@+id/thumbnail"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:clickable="true"
android:contentDescription="@string/app_name"
android:focusable="true"
android:src="@drawable/ic_job" />
</RelativeLayout>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/thumbnailRelative"
android:background="@color/full_transparent_color"
android:gravity="start"
android:padding="5dp"
android:text="@string/app_name"
android:textColor="@color/black"
android:textSize="13sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
This is what I am getting