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安全技术大本营

  • 相关阅读:
    Unity
    Unity
    Unity
    Unity
    Unity项目
    Unity
    UnityShader
    Unity
    【数据结构与算法】链表——奇偶链表
    【数据结构与算法】链表——分隔链表
  • 原文地址:https://www.cnblogs.com/hehehaha/p/6147161.html
Copyright © 2011-2022 走看看