I have an AutoCompleteTextView
on an AlertDialog
. The dropdown list with the suggestions gets partly covert by the keyboard (see screenshot). The result is that I cannot scroll the list.
I already managed to move the dialog to the top of the screen to get more space. When I set android:dropDownHeight
to a small value like 150dp the dropdown list is not covert by the keyboard anymore and scrolling works just fine but setting dropDownHeight
to a fix value doesn't seem to be a good solution. I want to avoid using "magic numbers" because otherwise I have no guarantee that it will work on all screens.
How can I solve this?
I finally got it working. This line of code did it for me. This way the dropdown list is always fitting with the keyboard.
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);