ClassCastException:ColorDrawable cannot be cast to RoundRectDrawableWithShadow
来源:互联网 发布:电子琴和吉他知乎 编辑:程序博客网 时间:2024/06/13 12:39
错误信息
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
(本公众号支持投票)
0 0
- ClassCastException:ColorDrawable cannot be cast to RoundRectDrawableWithShadow
- ClassCastException: $Proxy0 cannot be cast to ...
- ClassCastException:SpannableString cannot be cast to String
- java.lang.ClassCastException: $Proxy cannot be cast to
- java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to ]
- ClassCastException: $Proxy0 cannot be cast to (com......) 的解决办法
- java.lang.ClassCastException: android.app.Application cannot be cast to *****
- java.lang.ClassCastException: android.app.Application cannot be cast to *****
- java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
- java.lang.ClassCastException: android.app.Application cannot be cast to
- java.lang.ClassCastException:android.os.BinderProxy cannot be cast to...
- java.lang.ClassCastException: RequestFacade cannot be cast to MultipartHttpServletRequest
- .ClassCastException: .LinearLayout cannot be cast to android.widget.TextView
- java.lang.ClassCastException: android.app.Application cannot be cast to
- java.lang.ClassCastException: SpringServletContainerInitializer cannot be cast to ServletContainerIn
- java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
- .ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to
- java.lang.ClassCastException: android.app.Application cannot be cast to
- CCM认证加密
- 点击同一图片,控制音乐开始、暂停
- <OJ_Sicily>Maze
- OSPF学习笔记
- Android Framework启动流程分析
- ClassCastException:ColorDrawable cannot be cast to RoundRectDrawableWithShadow
- 抽象工厂设计模式
- wireshark捕获指定ip地址数据包
- 198. House Robber
- oracle11g SCN概述
- quartz的定时任务
- 仿网易新闻客户端UI界面小Demo
- 多线程学习(十三)新特征--锁
- 基于Jenkins快速搭建持续集成环境