Автозаполнение слово предложение по горизонтали в Android - PullRequest
2 голосов
/ 26 января 2011

Мне нужно сделать предложение автозаполнения слова. Когда я нажимаю «th» в текстовом поле «Автозаполнение», он отображает «the», «there», «те» ... как в вертикальном списке чтобы отобразить эти результаты (те, там, те ..) по горизонтали. Как я могу это сделать?

Мой код:

public class AutoCompleteDemo extends Activity
implements TextWatcher {
TextView selection;
AutoCompleteTextView edit;

String[] items={"lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
"ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
"porttitor", "sodales", "pellentesque", "augue", "purus"};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);

edit=(AutoCompleteTextView)findViewById(R.id.edit);
edit.addTextChangedListener(this);
edit.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple dropdown item 1line,
items));
}


public void onTextChanged(CharSequence s, int start, int before,
int count) {

}


public void beforeTextChanged(CharSequence s, int start,
int count, int after) {
// needed for interface, but not used
}


public void afterTextChanged(Editable s) {
// needed for interface, but not used
}
}
...