最近在开发的时候遇到了一点小问题感觉这个也是坑分享给大家
在开发widget的时候需要实现透传到自定义view里面需要用到RemotableViewMethod
但是我加了这个注解后无法调用到这个注解。
我就不废话了先复制源码
RemotableViewMethod类
package android.view;
@TargetApi(30)
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface RemotableViewMethod {
String asyncImpl() default "";
}
TargetApi接口
package android.annotation;
@Target({TYPE, METHOD, CONSTRUCTOR, FIELD})
@Retention(RetentionPolicy.CLASS)
public @interface TargetApi {
int value();
}
但是在这里需要注意的是包名一定要与源码的包名一致 一定要在这个包名路径下才可以生效



