在multiselect中选择第一个值后,它不会在AutoCompleteTextView中显示搜索值,因为它取的是MultiAutoCompleteTextView Text的整个值。请帮我解决这个问题。
private MultiAutoCompleteTextView text;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
text = FindViewById<MultiAutoCompleteTextView>(Resource.Id.mulAuto);
text.DropDownHeight = 500;
text.Threshold = 1;
text.TextChanged += text_TextChanged;
}
async void text_TextChanged(object sender, Android.Text.TextChangedEventArgs e)
{
List<string> str = new List<string>();
HttpClient client = new HttpClient();
string API = "http://" + IPAddress + "/api/Test/getdata?searchstr=" + e.Text;
var data = await client.GetStringAsync(API);
JSONArray array = new JSONArray(data);
for (int i = 0; i < array.Length(); i++)
{
str.Add(array.GetJSONObject(i).GetString("Name"));
}
ArrayAdapter adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleDropDownItem1Line, str);
text.Adapter = adapter;
text.SetTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}
取以前选择的值。另外,这是我的代码。