I have a dialog window that covers 1/3 of the entire screen height and is displayed on top of my activity. The dialog holds two AutoCompleteTextView fields.
The problem I'm facing is that when the user starts typing something into the AutoCompleteTextView, the list with all suggestions only shows up to the bottom end of the dialog, but doesn't go beyond that even the list is longer. It looks like it's cut off. (screenshot left)
Only after I long-press an item from the suggestion list, the list will be shown in full length. (screenshot right)
Screenhot is at: http://img704.imageshack.us/i/dialogdropdown.png/ screenshot http://img704.imageshack.us/img704/1893/dialogdropdown.png
How to fix this behaviour so that the list shows in full length right from the beginning, when the user starts typing something?
Code-wise there's nothing special, all I do is:
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 idea is to somehow dispatch a motion event to simulate a touch (but then not selecting though) one of the list items. Any concrete idea in code for a solution, anybody?
Right now I'm assuming it's a bug, which I already filed here: http://code.google.com/p/android/issues/detail?id=9917
But if anybody knows a solution to this, I'd greatly appreciate it and would be glad to trade it for some bounty points.
Edit:
One workaround that came to my mind is now to extend the dialog to the very bottom of the screen but leave the background transparent, so it looks the same as now, but actually has a height that wouldn't cut off the list. I will give that a try...
Not long ago i faced this problem. I had small dialog with AutoCompleteTextView
, which had more than 10 items in Drop Down list. This list was cutted. My solution was:
Place some empty View
in my Dialog layout file with parameters
<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>
It made my little dialog like a full screen dialog, but actualy that "tail" wasn't showed, and my DropDown wasn't cutted at all, cause it had enough place to show list items from DropDown.
if (yourlist.size() > 5) {
yourtextview.setDropDownHeight(562);
} else {
yourtextview.setDropDownHeight(anytextview.getHeight() * yourlist.size());
}
//Workaround -> Write this condition under on click and on focus change of your autocomplete text view
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With