MultiAutoCompleteTextView无论有没有设置 android:completionThreshold="3" 都无法显示出匹配字出来
android:id="@+id/multiAutoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/autoCompleteTextView1"
android:completionThreshold="3"
android:hint="@string/N_name" />
/*
*下面是activit。main的
*/
public class MainActivity extends Activity {
private AutoCompleteTextView ACTextView;
private MultiAutoCompleteTextView MACTextView;//多个选择
private String[] res={"baicheng","bixin","beijing","beifang","guangzhou"};//数据源
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ACTextView=(AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
ArrayAdapter<String> adapeter=new ArrayAdapter<String>(this,
android.R.layout.simple_expandable_list_item_1, res);
//adapter为适配器,至于为什么要做一个适配器,用来初始化数据源。
ACTextView.setAdapter(adapeter);//ACTextView与数据源相连。
MACTextView=(MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView1);
MACTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
}