Changing the width of AutoCompleteTextView in Android

I find setDropDownAnchor() to be much more convenient.

Just pass the id of some view and drop down view will match its width and position (no matter where the actual text view is placed).

In your example that could be the parent of both: button and text view.


You can set this attribute in the description of this widget using the attribute:

android:dropDownWidth="match_parent"

If you would like to do this in java 'programmatically', use the method setDropDownWidth(int):

myAutoCompleteTextView.setDropDownWidth(int)

Edit 1:

Point pointSize = new Point();

getWindowManager().getDefaultDisplay().getSize(pointSize);

myAutoCompleteTextView.setDropDownWidth(pointSize.x);