Search code examples
android-studiocardview

CardView background is black in preview


When creating an empty CardView in Android, Android Studio shows me a CardView with a black background in the preview. When I install the app on the device, the background of the cardview changes to the default one. Has it to do something with the styles.xml file?

enter image description here


Solution

  • It's due to update the Support Library to version 27.1.0. Downgrading to the previous version (27.0.2) solves this little problem.

    However, I'd use 27.1.0 and wait for a fix since, as you say, this problem only happens in preview.