java.lang.UnsupportedOperationException: Can't convert to integer: type=0x3
2016-08-10 12:55
513 查看
在自定义属性的时候,运行报错了:Caused by: java.lang.UnsupportedOperationException: Can’t convert to integer: type=0x3
原因:我在定义View的时候,定义了图片的属性,获取代码如下
然后就报错了,而在xml中布局的时候,就一直有warning: drawable… in attr “defaultFirstIcon” is a inviald integer。
解决:正确的代码如下,将 getInteger 改成 getResourceId
原因:我在定义View的时候,定义了图片的属性,获取代码如下
case R.styleable.NaviBottomBar_defaultFirstIcon: defaultResIds[0] = types.getInteger(attr, 0); break;
然后就报错了,而在xml中布局的时候,就一直有warning: drawable… in attr “defaultFirstIcon” is a inviald integer。
解决:正确的代码如下,将 getInteger 改成 getResourceId
defaultResIds[0] = types.getResourceId(attr, 0);
相关文章推荐
- java.lang.UnsupportedOperationException: Can't convert to fraction: type=0x3问题解决
- java.lang.UnsupportedOperationException,Can't convert to dimension: type=0x1,TypedArray.java,702
- Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x1
- Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- UnsupportedOperationException: Can't convert to dimension:type=0x1解决方案
- java.lang.UnsupportedOperationException: Can't write to a readonly object
- Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 1 to dimension
- HibernateProxy异常处理 java.lang.UnsupportedOperationException: Attempted to serialize java.lang.Class:
- java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
- 使用TextInputLayout所遇到的坑-java.lang.UnsupportedOperationException: Failed to resolve attribute at index
- UnsupportedOperationException: Can't convert to color (?attr/colorPrimaryn )
- java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
- java.lang.IllegalArgumentException: Cannot convert value of type [] to required type [] for property
- UnsupportedOperationException: Can't convert to color (?attr/colorPrimaryn )
- java.lang.UnsupportedOperationException
- java.lang.UnsupportedOperationException at java.util.AbstractList
- Spring3MVC 提交请求参数中的日期问题(java.lang.String cant not convert to java.util.Date)
- 启动Tomcat时遇到的 java.lang.IllegalArgumentException: Can't convert argument: null 异常