Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrolling drop-down-menu over the keyboard in autocompletetextview

I have an Autocompletetextview dropping down the suggestions list, up to the border of the soft-keyboard.

Then, when scrolling over the suggestions list: - (in a gingerbread phone) the drop-down-menu automatically increases height covering the keyboard, which is nice since it shows more items. - (in an ICS emulator) the drop-down-menu does not increase height over the keyboard.

Is this related to some system property? Is there a way to force the first behavior also in ICS?

like image 296
rmarau Avatar asked Feb 07 '13 12:02

rmarau


4 Answers

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

like image 137
Deepak Goel Avatar answered Nov 11 '22 03:11

Deepak Goel


Let me explain my little trick to avoid that the "drop-down" displays behind the keyboard. The trick is with the dropDownAnchor property. The solution is set the anchor with a view located on the top of the screen, so the menu will leave from that position, and therefore, will not be covered by the keyboard. For example:

android:dropDownAnchor="@+id/topview"

I know that is an ugly solution but this control is too limited.

like image 20
pgarriga Avatar answered Nov 11 '22 04:11

pgarriga


You can also use android:dropDownAnchor="@id/ to anchor the dropdown to a view.

like image 1
Hoang Avatar answered Nov 11 '22 04:11

Hoang


Just add getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); to your fragment or activity

like image 1
EzeKieL Avatar answered Nov 11 '22 02:11

EzeKieL