开发者

AutoComplete word suggestion horizontally in android

开发者 https://www.devze.com 2023-02-06 15:37 出处:网络
i need to do auto complete word suggestion.开发者_如何学运维When i click \"th\"on Autocomplete edit text box,It will display \"the\",\"there\",\"those\"...like that on vertical list view.I need to dis

i need to do auto complete word suggestion.开发者_如何学运维When i click "th"on Autocomplete edit text box,It will display "the","there","those"...like that on vertical list view.I need to display that results(the,there,those..)on horizontal way.How could i do this?

My code is:

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
}
}
0

精彩评论

暂无评论...
验证码 换一张
取 消