Xamarin Android通用ArrayAdapter<> - 方法不能覆盖

时间:2013-10-19 08:00:53

标签: c# android xamarin

在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);

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

0 个答案:

没有答案