Selection list is disabled in AutoCompleteTextView in dialog

I have a dialog box that covers 1/3 of the entire height of the screen and is displayed on top of my activity. The dialog box contains two AutoCompleteTextView fields.

The problem I am facing is that when the user starts typing something into the AutoCompleteTextView, the list with all the sentences is displayed only at the bottom of the dialog box, but does not go beyond that, even if the list is longer. Looks like he disconnected. (screenshot to the left)

Only after I click on an item from the list of offers for a long time, the list will be displayed in full. (screenshot to the right)

Screenshot taken at: http://img704.imageshack.us/i/dialogdropdown.png/ screenshot http://img704.imageshack.us/img704/1893/dialogdropdown.png

How to fix this behavior so that the list is displayed in full from the very beginning when the user starts typing something?

There is nothing special in the code, all I do:

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getContext(), R.layout.nav_route_autocomplete_row, locStrings); AutoCompleteTextView txtStartPos = (AutoCompleteTextView) findViewById(R.id.txtStartPos); txtStartPos.setAdapter(adapter); ... 

One workaround is to somehow send a motion event to simulate touching (but not selecting) one of the list items. Any specific idea in the code for the solution, anyone?

+6
android
source share
5 answers

Right now, I assume this is a bug that I have already filed here: http://code.google.com/p/android/issues/detail?id=9917

But if anyone knows a solution to this, I would be very grateful for this and would be happy to exchange it for some award points.

Edit:

A workaround that came to my mind is to expand the dialog to the very bottom of the screen, but leave it transparent, so it looks the same as it is now, but it actually has a height that would not cut the list, I'll let you try ...

+1
source share

I recently ran into this problem. I had a little dialogue with AutoCompleteTextView , in which there were more than 10 items in the drop-down list. This list has been cut off. My solution was:
Put empty View in my layout dialog with options

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- Some Views placed here --> <View android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="invisible" /> </LinearLayout> 

This made my little dialog look like a full-screen dialog, but in fact this β€œtail” was not shown, and my DropDown was not completely cut off, because it had enough space to display list items from DropDown.

+1
source share

Just take a picture in the dark, but have you tried to set android:clipChildren to false in the dialog box for your action?

0
source share

I have successfully achieved this, but it is not very.

I ended up redefining my SimpleCursorAdapter.newView() method, going up the ViewParent hierarchy until I reached the root of the View , and then changed its WindowManager.LayoutParams to ORing in the FLAG_LAYOUT_NO_LIMITS flag.

This needs to be redone every time a drop-down list is displayed.

0
source share

As shown here: Scrolling the drop-down menu above the keyboard in autocompletetextview

You can use the android: dropDownHeight property for AutoCompleteTextView to make it have a specific height. This does not actually solve the problem, but it is the best I can find.

Note: This problem only occurs when using AutoCompleteTextView inside a dialog . When used in an action or snippet layout, it just works fine.

This issue is present from Gingerbread to Jelly Bean.

0
source share

All Articles