Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoCompleteTextView drop down height limited in dialog popup

The dialog pop-up is located here.

How the AutoComplete results stop at the end of the pop-up view is here.

I want the results to drop down past the dialog's view to the parent view. If I can't do that then I want to limit the number of results the AutoComplete gives me to two.

This is in my on click listener for the popup menu.

addDialog.setContentView(R.layout.shoppinglistadd);

/**Capture the AutoCompleteTextView widget*/
final AutoCompleteTextView autoCompleteTV 
  = (AutoCompleteTextView) addDialog.findViewById(R.id.productEnteredShop);
/**Fills the autocomplete with possibilities*/
String[] acArray = getResources().getStringArray(R.array.completeFoodsList);
/**Create a new ArrayAdapter and bind shoppinglistitem.xml to each list item*/
ArrayAdapter<String> autoCompleteAdapter 
  = new ArrayAdapter<String>(ShoppingList.this, R.layout.shoppinglistitem, acArray);
/**Associate the adapter with textView*/
autoCompleteTV.setAdapter(autoCompleteAdapter);
like image 364
Mitch D Avatar asked Nov 12 '12 04:11

Mitch D


People also ask

Which properties can control type of character in AutoCompleteTextView control?

android:completionThreshold This defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu.

Which method is used for filling the data to AutoCompleteTextView?

Android AutoCompleteTextView Overview Some important methods of Autocomplete list are given below: getAdapter() : This method returns a filterable list adapter used for auto completion.


1 Answers

You should use this method to limit the height of dropdown for AutoCompleteTextView widget in xml:

android:dropDownHeight="size"

Or use this to do programmatically

autoCompleteTextView.setDropDownHeight(int);

Hope this help.

like image 198
i.n.e.f Avatar answered Oct 02 '22 20:10

i.n.e.f