How can I import the class android.graphics.drawable.shapes.Shape in XML in Android Studio? I'm getting "Cannot resolve class shape".
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
</shape>
CodePudding user response:
I think there aren't any problem in the code. Why don't you check these things.
- Did you write the code in res/drawable/something.xml? You have to write your own file name at the
something
part. - There isn't
<?xml version="1.0" encoding="utf-8"?>
at the top.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
</shape>
- Do Clean, Rebuild Project.
- Do Invalidate Cache/Restart.