Cardbackgroundcolor And Cardcornerradius Not Working In Androidx
Solution 1:
Try modifying the CardView as:
<androidx.cardview.widget.CardView
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="@dimen/retail_card_width"
app:cardCornerRadius="@dimen/card_radius"
app:cardBackgroundColor="@color/baseYellow"
android:layout_height="@dimen/retail_card_height">
Solution 2:
I might be late for this but let me save someone's time in the future. I had this problem on my Android Studio preview
and came to realise that the problem is that the content inside the CardView is not clipped
to the bounds of the CardView, so the corners you see are corners of the ImageView, which is actually clipped when you run the app on emulator/device.
I hope this helps!
Solution 3:
It turned out that the problem was I was mixing cardview androidx library with support recyclerview library. Once I rebuilt the project with:
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
everything turned out fine.
Solution 4:
I removed this lines in my Manifest file and after that my cardviews are worked prefectly fine
android:hardwareAccelerated="false"
Solution 5:
I had a similar problem. I solved it by wrapping the CardView in FrameLayout.
Post a Comment for "Cardbackgroundcolor And Cardcornerradius Not Working In Androidx"