zoukankan      html  css  js  c++  java
  • ClassCastException:ColorDrawable cannot be cast to RoundRectDrawableWithShadow

    错误信息

    java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow

    我在给CardView组件设置背景颜色属性时,起初是按照如下方法做的:

    cardView.setBackgroundColor(Color.parseColor("#ffffff"));

    但是运行后却报错,提示类型转换错误:java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawableWithShadow

    解决方案

    cardView.setCardBackgroundColor(Color.parseColor("#ffffff"));




    安卓开发高级技术交流QQ群:108721298 欢迎入群

    微信公众号:mobilesafehome

    (本公众号支持投票)

    Android安全技术大本营

  • 相关阅读:
    C语言I博客作业05
    C语言I博客作业04
    C语言II博客作业01
    学期总结
    第一周作业
    C语言I博客作业08
    C语言I博客作业07
    C语言I博客作业06
    C语言I博客作业05
    C语言I博客作业04
  • 原文地址:https://www.cnblogs.com/hehehaha/p/6147161.html
Copyright © 2011-2022 走看看