how to create editable dropdown in android? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question 开发者_运维技巧Can anyone help me with how to make an editable dropdown in android?
If editable you should use AutoCompleteTextView.
I have the same problem too. I finally tried 2 means:
Use AutoCompleTextView, it is pretty good.
Use
ListPopupWindow
with aEditText
. I finally used this and I wrote an article about it: http://maogm.com/blog/edittext-with-popuplist-en.html
The accepted answer helped me except I wanted the drop down to show immediately before the user starts typing (really an editable spinner) and didn't care much about auto completetion, so I let it have the immediate drop down effect by adding:
autoCompleteTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
autoCompleteTextView.showDropDown();
}
})
In case this helps someone.
Have you tried reading any tutorials?
For example: http://developer.android.com/guide/tutorials/views/hello-spinner.html http://www.designerandroid.com/?p=8
and so forth. Google for android spinner tutorials.
I changed the ArrayAdapter
method of spinner and i got my custom Spinner. just change the parameter of this method like
Spinner spinner = (Spinner) findViewById(R.id.Spinner01);
ArrayAdapter adapter=ArrayAdapter.createFromResource(This,R.array.statename,R.layout.mylayout);
spinner.setAdapter(adp);
In Which the mylayout file contains
精彩评论