Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1f

自定义属性之坑

不能定义名称为sdk的自定义属性名,如:


<!-- sdk attr -->
android:text
android:textSize
android:textColor
 
<!-- 自己定义的属性不能定义成上面的属性,不能定义如下 -->
 
<attr name="text" format="string"/>
<attr name="textSize" format="dimension"/>
<attr name="textColor" format="color"/>

通过TypedArray获取数据时还有可能为null

发布了27 篇原创文章 · 获赞 33 · 访问量 9503

猜你喜欢

转载自blog.csdn.net/qq_42470947/article/details/104282976
今日推荐