开发遇到的BUG
2017-08-04 本文已影响0人
清汤白面
为TextView的文字设置点击或者选择的变色效果。
selector_text.xml

在某些手机上会报错
inary XML file line #4: tag requires a 'drawable' attribute or child tag defining a drawable
发现是因为这个文件不应该放在drawable里面,而是放在res/color 文件里面, 引用方式
android:textColor="@color/selector_text"

在MVP模式中 因为这个问题爆过错误。
getClass().getGenericSuperclass()返回表示此Class所表示的实体(类、接口、基本类型或 void)的直接超类的 Type
然后将其转换ParameterizedType。。
getActualTypeArguments()返回表示此类型实际类型参数的 Type 对象的数组。
[0]就是这个数组中第一个了。。
简而言之就是获得超类的泛型参数的实际类型。。

