android 智能提示

<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:completionThreshold="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入"
/>

 

 

private String[] resourcesStrings = {"beijing1","beijing2","beijing3"};

//单个

autoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, resourcesStrings);
autoCompleteTextView.setAdapter(adapter);

//多个

multiAutoCompleteTextView = (MultiAutoCompleteTextView)findViewById(R.id.t2);
multiAutoCompleteTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
multiAutoCompleteTextView.setAdapter(adapter);

 

posted @ 2016-06-22 18:54  骑着龙的羊  阅读(192)  评论(0编辑  收藏  举报