我有一个Xamarin Android绑定错误,没有任何意义!

生成的类存根是:

[global::Android.Runtime.Register ("com/scichart/drawing/common/IRenderSurface", DoNotGenerateAcw=true)]
internal class IRenderSurfaceInvoker : global::Java.Lang.Object, IRenderSurface


[Register ("com/scichart/drawing/common/IRenderSurface", "", "Com.Scichart.Drawing.Common.IRenderSurfaceInvoker")]
public partial interface IRenderSurface : global::Com.Scichart.Core.Framework.IInvalidatableElement, global::Com.Scichart.Core.Framework.IView { }

// Metadata.xml XPath interface reference: path="/api/package[@name='com.scichart.core.framework']/interface[@name='IView']"
[Register ("com/scichart/core/framework/IView", "", "Com.Scichart.Core.Framework.IViewInvoker")]
public partial interface IView : global::Com.Scichart.Core.Framework.IContextProvider, global::Com.Scichart.Core.Framework.IHitTestable
{

    int Visibility
    {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.scichart.core.framework']/interface[@name='IView']/method[@name='getVisibility' and count(parameter)=0]"
        [Register ("getVisibility", "()I", "GetGetVisibilityHandler:Com.Scichart.Core.Framework.IViewInvoker, SciChart.Android.Core")] get;
        // Metadata.xml XPath method reference: path="/api/package[@name='com.scichart.core.framework']/interface[@name='IView']/method[@name='setVisibility' and count(parameter)=1 and parameter[1][@type='int']]"
        [Register ("setVisibility", "(I)V", "GetSetVisibility_IHandler:Com.Scichart.Core.Framework.IViewInvoker, SciChart.Android.Core")] set;
    }
}


发生的是IView.Visibility(已获取并设置)与基类Android.View.Visibility发生冲突。我已经解决了additions文件夹中的冲突,但是存在此IRenderSurfaceInvoker类,该类是生成的,而不是局部的,并且没有正确实现IView接口。

java - Xamarin Android绑定(bind)类FooInvoker未实现接口(interface)设置程序-LMLPHP

通常,我会忽略meta.xml中的属性,并在部分类中手动创建它,但这是不可能的,因为IRenderSurfaceInvoker不是部分。

到底什么是FooInvoker ?!

有任何想法吗? :)

编辑:更新

在以下Sven-Michael Stube回答之后,我有了这个部分解决方案:

<!-- In EnumMethods.xml -->
<mapping jni-interface="com/scichart/core/framework/IView">
    <method jni-name="getVisibility" parameter="return" clr-enum-type="Android.Views.ViewStates" />
    <method jni-name="setVisibility" parameter="visibility" clr-enum-type="Android.Views.ViewStates" />
</mapping>


但这会导致生成IView接口,如下所示:

    global::Android.Views.ViewStates Visibility {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.scichart.core.framework']/interface[@name='IView']/method[@name='getVisibility' and count(parameter)=0]"
        [Register ("getVisibility", "()I", "GetGetVisibilityHandler:Com.Scichart.Core.Framework.IViewInvoker, SciChart.Android.Core")] get;
    }


和警告输出

<attr path="/api/package[@name='com.scichart.core.framework']/interface[@name='IView']‌​/method[@name='setVisibility']/parameter[@name='visibility']"/> matched no nodes


换句话说,上面的EnumMethods.xml声明会删除设置器,因为它找不到匹配项。

我该如何调试?

最佳答案

我认为您不必解决View vs IView问题。您应该在EnumMethods.xml中重写getter的返回值和setter的参数为Android.Views.ViewStates。如果始终如一,这可能会解决您的问题。

<mapping jni-interface="com/scichart/core/framework/IView">
    <method jni-name="getVisibility" parameter="return" clr-enum-type="Android.Views.ViewStates" />
    <method jni-name="setVisibility" parameter="p0" clr-enum-type="Android.Views.ViewStates" />
</mapping>

10-06 02:50