Reputation: 11
I am using Android Studio 4.1.1. I can use card view in an empty activity XML file. But I can not use card view in a drawable resource file. Anyone can please help me?
Also, I included the dependencies as following.
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.cardview:cardview:1.0.0"
Upvotes: 1
Views: 324
Reputation: 11
You wont be able to use cardview in drawable. If you are looking to use it to set as a background for a view, create an xml file in layout and use the file as the background.
Upvotes: 0
Reputation: 252
You can't use CardView
in drawables. CardView
as the name suggests is a View
. Drawable is a resource. Can you post more what you are hoping to achieve by including CardView
in Drawable? I may be able to suggest an alternative way to achieve the desired result.
Upvotes: 1