3

在 ArrayAdapter 的 Xamarin 实现中,所有方法都标记为虚拟/覆盖(允许自定义适配器):

    [Register("getItem", "(I)Ljava/lang/Object;", "GetGetItem_IHandler")]
    public override Object GetItem(int position);
    [Register("getItemId", "(I)J", "GetGetItemId_IHandler")]
    public override long GetItemId(int position);
    [Register("getPosition", "(Ljava/lang/Object;)I", "GetGetPosition_Ljava_lang_Object_Handler")]
    public virtual int GetPosition(Object item);

但是在泛型类中,它们没有被标记为虚拟/覆盖(防止泛型自定义适配器):

    [Register("add", "(Ljava/lang/Object;)V", "GetAdd_Ljava_lang_Object_Handler")]
    public void Add(T @object);
    [Register("createFromResource", "(Landroid/content/Context;II)Landroid/widget/ArrayAdapter;", "")]
    public static ArrayAdapter<Java.Lang.ICharSequence> CreateFromResource(Context context, int textArrayResId, int textViewResId);
    [Register("getItem", "(I)Ljava/lang/Object;", "GetGetItem_IHandler")]
    public T GetItem(int position);

为什么?这是一个错误吗?

4

0 回答 0