Xamarin Android库绑定,删除覆盖修饰符 [英] Xamarin Android library binding, remove override modifier

查看:154
本文介绍了Xamarin Android库绑定,删除覆盖修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Xamarin Android Binding项目中绑定Android PDF库,但是向属性添加了不必要的覆盖"修饰符:

I am trying to bind an Android PDF library in a Xamarin Android Binding project, but a unnecessary "override" modifier is added to a property:

public partial class ReaderView : global::Android.Widget.AdapterView, [...] {
    // ...

    public override unsafe global::Android.Widget.IAdapter Adapter {
        // Metadata.xml XPath method reference: path="/api/package[@name='com.artifex.mupdfdemo']/class[@name='ReaderView']/method[@name='getAdapter' and count(parameter)=0]"
        [Register ("getAdapter", "()Landroid/widget/Adapter;", "GetGetAdapterHandler")]
        get {
            // ...
        }
        // Metadata.xml XPath method reference: path="/api/package[@name='com.artifex.mupdfdemo']/class[@name='ReaderView']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='android.widget.Adapter']]"
        [Register ("setAdapter", "(Landroid/widget/Adapter;)V", "GetSetAdapter_Landroid_widget_Adapter_Handler")]
        set {
            // ...
        }
    }

    // ...
}

我尝试了这个但没有成功:

I tried this without success:

<attr path="/api/package[@name='com.artifex.mupdfdemo']/class[@name='ReaderView']/method[@name='getAdapter' and count(parameter)=0]" name="override">false</attr>
<attr path="/api/package[@name='com.artifex.mupdfdemo']/class[@name='ReaderView']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='android.widget.Adapter']]" name="override">false</attr>

你们对如何执行此操作有任何想法吗?

Do you guys have any idea about how to do this?

编辑1 :Java项目在GitHub上: https://github.com/asimmon/MuPDF-for-Android ,这是一个

Edit 1: The Java project is on GitHub: https://github.com/asimmon/MuPDF-for-Android and here is a direct link to the file ReaderView.java.

编辑2 :Xamarin绑定项目也在GitHub上,您将找到Jar库: https://github.com/asimmon/MuPDF-for-Xamarin-Android

Edit 2: The Xamarin Binding Project is on GitHub too, you will find the Jar library: https://github.com/asimmon/MuPDF-for-Xamarin-Android

推荐答案

解决方案是修改Metadata.xml中方法的visibility:

The solution is to modify the visibility of the method in Metadata.xml:

<attr 
   path="/api/package[@name='com.artifex.mupdfdemo']/class[@name='ReaderView']/method[@name='getAdapter']"
   name="visibility">public</attr>

这有效地从方法的签名中删除了override关键字.

This effectively removes the override keyword from your method's signature.

这篇关于Xamarin Android库绑定,删除覆盖修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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