0

我一直在 Xamarin.Android 中修复一个库:

https://stackoverflow.com/a/56778629/2889347

但是,我发现我的代码中缺少一个重要的方法:

/**
 * Sets a custom adapter for suggestions list view.
 *
 * @param suggestionAdapter customized adapter
 */
public void setCustomSuggestionAdapter(SuggestionsAdapter suggestionAdapter) {
    this.adapter = suggestionAdapter;
    RecyclerView recyclerView = findViewById(R.id.mt_recycler);
    recyclerView.setAdapter(adapter);
}

我试图实现一个部分类:

using System;
using System.Collections.Generic;
using Android.Runtime;
using Java.Interop;

namespace Com.Mancj.Materialsearchbar
{

    public partial class MaterialSearchBar
    {
    }
}

但我收到这样一条消息:

部分类与单个部分。

生成的类是这个:https ://www.dropbox.com/s/cb9oqtp6efys843/Com.Mancj.Materialsearchbar.MaterialSearchBar.cs?dl=0

过去我仍然遇到一个非常具体的问题,我无法使用FindViewByID,因为它找不到任何东西,我还在Metadata.xml中尝试了类似这样的代码:

<add-node path="/api/package[@name='com.mancj.materialsearchbar.adapter']/class[@name='MaterialSearchBar']/method[@name='setCustomSuggestionAdapter'] and count(parameter)=1 and parameter[1][@type='Com.Mancj.Materialsearchbar.Adapter.SuggestionsAdapter']" />

但是 VS 崩溃了:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Bindings.targets(5,5):错误 MSB6006:“generator.exe”退出,代码为 1。 (MSB6006) (Xamarin-SearchBar -V2)

如果你想测试我当前版本的代码:

https://github.com/FANMixco/Xamarin-SearchBar

感谢您的任何想法。

4

0 回答 0