5、AutoCompleteTextViewt是自动补全提示这里是单个提示,这种搜索提示到处可见,最简单的就是搜索引擎的搜索提示
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint = "请输入你要搜索的内容"
android:completionThreshold="2"
/>
<MultiAutoCompleteTextView
android:id="@+id/MautoCompleteTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint = "请输入你要搜索的内容"
android:completionThreshold="2"
>在activity里的代码
acCompleteText = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, res);
acCompleteText.setAdapter(adapter);
macCompleteText = (MultiAutoCompleteTextView) findViewById(R.id.MautoCompleteTextView);
ArrayAdapter<String> madapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, res);
macCompleteText.setAdapter(madapter);
macCompleteText.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
private String[] res = {"beingjing", "beijign1", "beijing2", "zhang", "zhanyyan"};