Reputation: 4857
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?
Upvotes: 3
Views: 4543
Reputation: 236
unfortunately the correct answer does not work and the only way to do it is to set a height as follows:
autoCompletetxtView.setDropDownHeight(int);
Upvotes: 0
Reputation: 4857
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);
Upvotes: 8
Reputation: 5892
That is because the window of your app is not being resized properly. Try to add in your manifest for this activity android:windowSoftInputMode="adjustResize"
Upvotes: 0