AutoCompleteTextView and MultiAutoCompleteTextView

来源:互联网 发布:后期软件 油画质感 编辑:程序博客网 时间:2024/04/25 09:20

public class AtyUsingAutoCompleteTextView extends Activity {

private AutoCompleteTextView actv;private MultiAutoCompleteTextView mactv;private ArrayAdapter<String> actvAdapter,mactvAdapter;private String[] strs = new String[]{        "hello",        "hello eoe",        "hello eoe.cn",        "hello eoeAndroid",        "hello eoe iOS",        "java",        "javascript",        "php",        "python"};@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.aty_using_autocompletetextview);    actvAdapter = new ArrayAdapter<String>(this, R.layout.aty_using_autocompletetextview_dropdown_item,strs);    actv = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);    actv.setAdapter(actvAdapter);    mactv = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView);    mactvAdapter = new ArrayAdapter<String>(this, R.layout.aty_using_autocompletetextview_dropdown_item,strs);    mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());    mactv.setAdapter(mactvAdapter);}

}

0 0