Entretoize
Entretoize

Reputation: 2251

Show AutoCompleteTextView on the first click

I'm using the AutoCompleteTextView to show a dropdown list when the user enter a word , but I would like the dropdown list to show when he first tap in the field. Maybe it would be better with a spinner but I would have no text input...

Upvotes: 1

Views: 652

Answers (1)

Tung Tran
Tung Tran

Reputation: 2955

Just call autoCompleteTextView.showDropDown() in onTouch method.

mAnswer.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    mAnswer.showDropDown();
                }

                return false;
            }
        });

Upvotes: 1

Related Questions