Android : autocompletetextview, suggestion list di

2019-01-18 06:15发布

问题:

did one of you ever run into that problem ?

With some high resolutions screen it displays correctly :

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

回答1:

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



回答2:

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



回答3:

You can try this method:

autoCompleteTextView.setDropDownVerticalOffset();


回答4:

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.