自定义视图缺少适配器工具使用的构造函数

sal*_*and 9 android warnings adapter listadapter android-arrayadapter

我收到以下警告:

自定义视图com/example/view/adapter/SomeAdapter缺少工具使用的构造函数:(Context)或(Context,AttributeSet)或(Context,AttributeSet,int)

在我的类SomeAdapter中,它扩展了一些扩展ArrayAdapter的BaseAdapter

public class SomeAdapter extends BaseAdapter{}
public abstract class BaseAdapter extends ArrayAdapter<SomeModel>{}
Run Code Online (Sandbox Code Playgroud)

警告存在于具体适配器中,但不存在于抽象BaseAdapter中.在这种情况下有没有人听说过这个警告?

AFAIK Android通过ViewConstructorDetector检查超类的名称来检查类是否正在扩展视图:

 private static boolean isViewClass(ClassContext context, ClassNode node) {
    String superName = node.superName;
    while (superName != null) {
        if (superName.equals("android/view/View")                //$NON-NLS-1$
                || superName.equals("android/view/ViewGroup")    //$NON-NLS-1$
                || superName.startsWith("android/widget/")       //$NON-NLS-1$
                && !((superName.endsWith("Adapter")              //$NON-NLS-1$
                        || superName.endsWith("Controller")      //$NON-NLS-1$
                        || superName.endsWith("Service")         //$NON-NLS-1$
                        || superName.endsWith("Provider")        //$NON-NLS-1$
                        || superName.endsWith("Filter")))) {     //$NON-NLS-1$
            return true;
        }

        superName = context.getDriver().getSuperClass(superName);
    }

    return false;
}
Run Code Online (Sandbox Code Playgroud)

据我所知,我的班级名称与上述模式不符.有谁知道如何修复或抑制此警告?

BaseAdapter中的getView():

@Override
public final View getView(final int position, final View convertView, final ViewGroup parent) {
    View view = convertView;
    if (null == view) {
        view = createNewView(parent, position);
    } else {
        reuseOldView(view, position);
    }
    return view;
}
Run Code Online (Sandbox Code Playgroud)

Jar*_*vis 11

在CustomView类中添加构造函数:

public CustomView(Context context) {
    super(context);
}
public CustomView(Context context, AttributeSet attrs) {
    super(context, attrs);
}
Run Code Online (Sandbox Code Playgroud)