问题
I am binding the github project ChatKit
I do this 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>
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)'
And there is any way to fix it?
回答1:
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
来源:https://stackoverflow.com/questions/45754424/xamarin-android-binding-thorw-does-not-implement-inherited-abstract-member-rec