一,布局
<MultiAutoCompleteTextView
android:completionThreshold="1"
android:layout_marginTop="30dp"
android:hint="请输入需要搜索的内容(可输入多个)"
android:id="@+id/multi_autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
二,代码
MultiAutoCompleteTextView multiautoCompleteTextView = (MultiAutoCompleteTextView) findViewById(R.id.multi_autoCompleteTextView);
multiautoCompleteTextView.setAdapter(stringArrayAdapter);
//设置以逗号分隔符为结束的符号
multiautoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());