I'm using below code to create a CardView
with corners but it stay rectangular
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/cardview_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:clickable="true"
android:focusable="true"
android:foreground="?android:attr/selectableItemBackground"
card_view:cardCornerRadius="6dp">
UPDATE : there was a mistake in my Manifest i just remove this line:
android:hardwareAccelerated="false"
I also had same issue. The issue I found is...
android:hardwareAccelerated="false"
removed this line from manifests and the issue resolved for me.
I saw nothing wrong with your code, but if it couldn't worked. try to add this:
app:cardCornerRadius="@dimen/margin_small"
app:cardElevation="@dimen/margin_small"
app:cardUseCompatPadding="true"
It worked well for me. And make sure you're runing above API 21.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With