title: Android CardView: Why the corners are not round?
body: <p>SOLVED!</p>
  
  <p>Solution: 
  remove the background color from the layout and set it on the card view itself as</p>
  
  <p><code>app:cardBackgroundColor=" # the color you want"</code></p>
  
  <p>and make sure you have the following dependency </p>
  
  <p><code>implementation 'com.google.android.material:material:1.1.0'</code></p>
  
  <p>Those should do the job.</p>
  
  <p>Update! --> Added extra information</p>
  
  <p>I have the following activity in which I try to make 3 card views containing information.
  And I want to make the card views to have rounded corners.</p>
  
  <p>I use the <code>app:cardCornerRadius="8dp"</code> but it's not showing any result, the corners still do not look round.</p>
  
  <p>Any idea where is my mistake and what I need to do in order to have them rounded?
  Is it because of the layout inside the CardView?</p>
  
  <p><strong>Thank you!</strong></p>
  
  <p>Below you can see the XML file </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".view.ViewRecipe"
      android:padding="16dp"
      android:background="@color/mainBackgroundColorRM"&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:layout_gravity="center"&gt;
  
  
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginStart="16dp"
              android:fontFamily="sans-serif"
              android:text="Spaghette"
              android:textAlignment="center"
              android:textColor="#000000"
              android:textSize="32sp" /&gt;
  
  
          &lt;androidx.cardview.widget.CardView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginStart="8dp"
              android:layout_marginTop="12dp"
              android:layout_marginEnd="8dp"
              app:cardPreventCornerOverlap="false"
              app:cardCornerRadius="8dp"
              app:cardElevation="20dp"&gt;
  
              &lt;!-- Here add the Contact Details--&gt;
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:background="@color/buttonColorRM"
                  android:paddingStart="32dp"
                  android:paddingTop="8dp"
                  android:paddingEnd="32dp"
                  android:paddingBottom="8dp"&gt;
                  &lt;!-- Here add the time value --&gt;
                  &lt;TextView
                      android:id="@+id/text_view_duration_value"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentEnd="true"
                      android:text="10 minute"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
                      android:textColor="#000000"&gt;
                  &lt;/TextView&gt;
  
                  &lt;!-- Here add the portii value --&gt;
                  &lt;TextView
                      android:id="@+id/text_view_servings_value"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/text_view_duration_value"
                      android:layout_alignParentEnd="true"
                      android:text="@string/Servings_VALUE_demo"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
                      android:textColor="#000000"&gt;
                  &lt;/TextView&gt;
  
                  &lt;!-- Duration is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_duration"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="@string/text_duration_ViewRecipe"
                      android:layout_toStartOf="@id/text_view_duration_value"
                      android:layout_alignParentStart="true"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
                      android:textColor="#000000"
                      android:textStyle="bold"&gt;
                  &lt;/TextView&gt;
  
                  &lt;!-- Time is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_portii"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/text_view_duration"
                      android:text="@string/text_servings_ViewRecipe"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
                      android:textColor="#000000"
                      android:textStyle="bold"&gt;
  
                  &lt;/TextView&gt;
  
              &lt;/RelativeLayout&gt;
  
          &lt;/androidx.cardview.widget.CardView&gt;
  
          &lt;!-- Ingredients --&gt;
          &lt;androidx.cardview.widget.CardView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="12dp"
              app:cardElevation="20dp"
              app:cardPreventCornerOverlap="false"
              app:cardCornerRadius="8dp"&gt;
  
              &lt;!-- Here add the Contact Details--&gt;
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:paddingTop="8dp"
                  android:paddingBottom="8dp"
                  android:paddingStart="32dp"
                  android:paddingEnd="32dp"
                  android:background="@color/buttonColorRM"&gt;
  
                  &lt;!-- Duration is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_ingredients"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="  Incrediente:"
                      android:layout_alignParentStart="true"
                      android:ellipsize="end"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
                      android:textColor="#000000"
                      android:textStyle="bold"
                      android:drawableStart="@drawable/list_icon"&gt;
                  &lt;/TextView&gt;
  
                  &lt;!-- Time is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_ingredients_value"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/text_view_ingredients"
                      android:text="Incredient 1, incredient 2, altul mai unul si ai unul"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
                      android:textColor="#000000"&gt;
  
                  &lt;/TextView&gt;
  
              &lt;/RelativeLayout&gt;
          &lt;/androidx.cardview.widget.CardView&gt;
  
          &lt;!-- Recipe --&gt;
          &lt;androidx.cardview.widget.CardView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginEnd="8dp"
              android:layout_marginStart="8dp"
              android:layout_marginTop="12dp"
              app:cardElevation="20dp"
              app:cardPreventCornerOverlap="false"
              app:cardCornerRadius="8dp"&gt;
  
              &lt;!-- Recipe description is here--&gt;
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:paddingTop="8dp"
                  android:paddingBottom="8dp"
                  android:paddingStart="32dp"
                  android:paddingEnd="32dp"
                  android:background="@color/buttonColorRM"&gt;
  
                  &lt;!-- Duration is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_recipe"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="@string/text_view_descriere_ViewRecipe"
                      android:layout_alignParentStart="true"
                      android:ellipsize="end"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large"
                      android:textColor="#000000"
                      android:textStyle="bold"
                      android:drawableStart="@drawable/description_icon"&gt;
                  &lt;/TextView&gt;
  
                  &lt;!-- Time is here--&gt;
                  &lt;TextView
                      android:id="@+id/text_view_recipe_value"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_below="@id/text_view_recipe"
                      android:text="@string/demo_reteta"
                      android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium"
                      android:textColor="#000000"&gt;
                  &lt;/TextView&gt;
  
              &lt;/RelativeLayout&gt;
          &lt;/androidx.cardview.widget.CardView&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>Also here it is the Gradle Module App file </p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 29
      buildToolsVersion "29.0.2"
      defaultConfig {
          applicationId "com.ciucurdaniel.romania.retetelemele"
          minSdkVersion 26
          targetSdkVersion 29
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
          }
      }
      compileOptions {
          targetCompatibility = 1.8
          sourceCompatibility = 1.8
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test.ext:junit:1.1.0'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  
      //AD MOB
      implementation 'com.google.android.gms:play-services-ads:19.1.0'
  
      //CardView
      implementation 'androidx.cardview:cardview:1.0.0'
  }
  </code></pre>