8

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...

AndiGeeky
  • 11,266
  • 6
  • 50
  • 66
KitAndKat
  • 953
  • 3
  • 14
  • 29

4 Answers4

12

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

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
manu
  • 129
  • 2
  • 4
  • you can also use "wrap_content" or "match_parent", which may be useful in some cases (see http://developer.android.com/reference/android/widget/AutoCompleteTextView.html#attr_android:dropDownHeight) – Maragues Oct 21 '14 at 16:12
  • 3
    If you set it too high, and you have a few items, there will be empty space. If you set it too low, and you have a lot of items, only few will be shown at the same time... – android developer Dec 31 '14 at 08:43
4
@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.

jun.wu
  • 104
  • 3
2

You can try this method:

autoCompleteTextView.setDropDownVerticalOffset();
Pang
  • 9,564
  • 146
  • 81
  • 122
xutingting
  • 31
  • 1
0

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.

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Ziwei Zeng
  • 691
  • 5
  • 21