Home » Android » Android : autocompletetextview, suggestion list displays above the textview?

Android : autocompletetextview, suggestion list displays above the textview?

Posted by: admin June 15, 2020 Leave a comment

Questions:

did one of you ever run into that problem ?

the list items displays above the textbox instead of appearing right under it !

With some high resolutions screen it displays correctly :

enter image description here

but the low resolutions it’s not displaying correctly are not so low, for example, in galaxy spica (320x480px). I would like the keyboard to be brought behind the suggestions list when this one gets the focus from the user who’s trying to scroll on it with one long click..

I’ ve tried : android:windowSoftInputMode="stateHidden|adjustPan” in the activity manifest.xml and all other combinations. still, it’s not working…
I tried to change the text size, the items size, the padding, the max height of the whole autocompletetextview, the max height of dropdownlist, tried a MultiAutoCompleteTextView, even tried to nest it in a scrollview, nothing.
it occurs because of the keyboard which “pushes” the list items above the textview so without the keyboard everything would be nice..

any help would be much appreciated…

How to&Answers:

Just add android:dropDownHeight="100dp" to the AutoCompleteTextView tag in your layout file,

Answer:

@Override
public void onFilterComplete(int count) {

    setDropDownHeight((count > DROPDOWN_LIST_COUNT ? DROPDOWN_LIST_COUNT : count) * getHeight() 
            + DROPDOWN_LIST_BORDER);

    super.onFilterComplete(count);
}

I’ve encountered the same problem and tried the code above. It makes sure dropdownlist shows DROPDOWN_LIST_COUNT items.

Answer:

You can try this method:

autoCompleteTextView.setDropDownVerticalOffset();

Answer:

There was more screen space above the AutocompleteTextView than below, so the list opened upwards. You may adjust your layout to make sure there’s more screen space(exclude the pop up keyboard)below the AutocompleteTextView. This issue seems has been fixed from ICS.