xamarin.android绑定thorw'未实现继承的抽象成员'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup,int)' [英] xamarin.android binding thorw 'does not implement inherited abstract member 'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup, int)'

查看:205
本文介绍了xamarin.android绑定thorw'未实现继承的抽象成员'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup,int)'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在绑定github项目 ChatKit

I am binding the github project ChatKit

我这样做xml

<attr name="managedType" path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onBindViewHolder']/parameter[1]">Android.Support.V7.Widget.RecyclerView.ViewHolder</attr>
  <attr name="managedType" path="/api/package[@name='com.stfalcon.chatkit.messages']/class[@name='MessagesListAdapter']/method[@name='onBindViewHolder']/parameter[2]">int</attr>

但是vs仍然为我抛出错误:

but vs still throw the error for me:

1>D:\TempApps\ChatKitDebugBinding\ChatKitDebugBinding\obj\Debug\generated\src\Com.Stfalcon.Chatkit.Messages.MessagesListAdapter.cs(10,23,10,42): error CS0534: 'MessagesListAdapter' does not implement inherited abstract member 'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup, int)'

有什么办法可以解决?

推荐答案

解决此问题的最简单方法是使用局部类.您可以通过使用适当的命名空间创建的部分类:

The easiest way to fix this is by partial classes. You can do this by creating a partial class of MessagesListAdapter with your appropriate namespace:

namespace Com.Your.Namespace
{
    partial class MessagesListAdapter
    {
    }
}

接下来,您可以在此局部类中实现重写:

Next you can implement the overrides inside this partial class:

public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
{
    throw new NotImplementedException();
}

public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
{
    throw new NotImplementedException();
}

最后,您可以浏览

Finally you can look through the source code and use the newly generated binding classes to implement these methods in C#:

OnBindViewHolder

OnCreateViewHolder

这篇关于xamarin.android绑定thorw'未实现继承的抽象成员'RecyclerView.Adapter.OnCreateViewHolder(ViewGroup,int)'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆