[Solved] Card layout parameters not working


You can try this as one of the solution if you do not want to specify the dimension for width and height of Image

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
    android:id="@+id/cvAdvertFavourite"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="2dip"
    android:layout_marginBottom="2dip"
    card_view:cardUseCompatPadding="true"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:padding="8dp"
        >

        <ImageView
            android:id="@+id/ivCardFavouriteAnimalPhoto"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="8dp"
            android:weight = "2"/>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:weight = "1" />

        <TextView
            android:id="@+id/tvCardFavouriteTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:textSize="20sp"
            />

        <TextView
            android:id="@+id/tvCardFavouriteRace"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tvCardFavouriteTitle"
            />

        <TextView
            android:id="@+id/tvCardFavouritePrice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tvCardFavouriteRace"
            />
      </RelativeLayout>
    </LinearLayout>

</android.support.v7.widget.CardView>

In this I have used LinearLayout which will distribute the screen width in the ratio 2:1 between ImageView and RelativeLayout with text.

Also I have reduced the size of text from 30sp to 20sp

solved Card layout parameters not working