Question

Friends,

can anyone guide me how to create editable spinner in Android?

any help would be appreciated.

Was it helpful?

Solution

If editable you should use AutoCompleteTextView.

OTHER TIPS

I have the same problem too. I finally tried 2 means:

  1. Use AutoCompleTextView, it is pretty good.

  2. Use ListPopupWindow with a EditText. 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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top