the following class could not found: corners,shape,solid
这个要这么解决啊???
the following class could not found: corners,shape,solid
这个要这么解决啊???
错误的原因是xml文件放在错误的路径,需要将其放在 res/drawable 目录下。
假设创建了background_square.xml(代码如下),并将它置于 res/drawable 中。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp" />
<solid
android:color="@color/primary_grey" />
</shape>
那么可以按照如下方式使用:
<Button
android:background="@drawable/buttonshape"
......
......
/>
当然,不仅是Button,也可以用到其它地方,取决于需要了