开发者

how to create editable dropdown in android? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

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:

  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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜