2

電子メール作成用のオートコンプリートと「オートボックス」(電子メールを選択した後、連絡先をボックスに入れてテキストボックスに配置するGmailアプリのように)を模倣するAndroid用のコントロールはありますか?

4

1 に答える 1

2

あなたはこのようなものを探しています:

main.xml

<MultiAutoCompleteTextView
 android:id="@+id/compose_to"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:hint="To"
 android:imeOptions="actionNext"
 android:textColor="#000000"
 android:inputType="textEmailAddress|textMultiLine"
 />

main.java

MultiAutoCompleteTextView to = (MultiAutoCompleteTextView) findViewById(R.id.compose_to);

ArrayList<String> addresses = new ArrayList<String>();
addresses.add("temp@gmail.com");
addresses.add("abc@gmail.com");
addresses.add("xyz@gmail.com");
addresses.add("template@gmail.com");

ArrayAdapter<String> autocompAdapter =  new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, addresses);

to.setAdapter(autocompAdapter);
to.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());

Android EditText オートコンプリート

于 2012-10-16T14:08:30.900 に答える