Home » Android » spinner – how to create editable dropdown in android?

spinner – how to create editable dropdown in android?

Posted by: admin June 15, 2020 Leave a comment

Questions:

Can anyone help me with how to make an editable dropdown in android?

How to&Answers:

If editable you should use AutoCompleteTextView.

Answer:

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

Answer:

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.

Answer:

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.

Answer:

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