我有一個Xamarin Android綁定錯誤,沒有任何意義!Xamarin Android綁定類FooInvoker沒有實現接口設置器
生成的類存根:
[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衝突。我已經在附加文件夾中解決了衝突,但是有這個IRenderSurfaceInvoker類生成,而不是部分,並且沒有正確實現IView接口。
一般情況下我忽略metadata.xml中的屬性,並以部分類手動創建它,但這是不可能的,因爲IRenderSurfaceInvoker不是局部的。
無論如何什麼是FooInvoker ??!
任何想法? :)
編輯:UPDATE
以下後,斯文邁克爾的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聲明刪除了setter,因爲它找不到匹配項。
我該如何調試?
一個小問題。 jni-class應該是jni-interface,否則兩個節點都找不到。但即使如此,它仍然取代了getVisbility並刪除了setVisibility和警告 不匹配任何想法? –
是一個叫'可見度?這只是一個猜測。 –
在java中,是的。 C#仍然無法找到它。然而,我將它命名爲p0並且它隨機工作:0 –