I have a linear layout with 2 text views that have different background colors. I want to make the whole view (linearlayout) with rounded corners. I tried enclosing it in MaterialCardview (as I was able to achieve that effect when I set the whole fragment layout inside) but for some reason it is not working. What do I need to do to achieve rounded corner on the view?
<android.support.design.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="8dp"
app:cardCornerRadius="20dp"
app:cardElevation="2dp"
app:cardBackgroundColor="@color/Transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tutTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tutorial_title"
android:text="Text 1"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="@color/White"
android:textSize="16sp" />
<TextView
android:id="@+id/tutBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tutorial_body"
android:padding="10dp"
android:drawableLeft="@drawable/image"
android:drawablePadding="10dp"
android:text="This is a hint"
android:textColor="@color/main_dark_grey"
android:textSize="16sp" />
</LinearLayout>
</android.support.design.card.MaterialCardView>
Note: I know some might suggest to use xml drawable with rounded background. This Won't work as the children background color will take over the transparency and will remain sharp edges