wanpengcheng199311 2017-04-06 09:53 采纳率: 0%
浏览 913
已采纳

android XML页面出现the following class could .......

the following class could not found: corners,shape,solid

这个要这么解决啊???

  • 写回答

1条回答 默认 最新

  • 战在春秋 2017-04-06 22:00
    关注

    错误的原因是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,也可以用到其它地方,取决于需要了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?