0

I have a AutoCompleteTextView at the top of my screen and have used the default List that is associated with the AutoCompleteTextView to display my data. I have a bottom navigation bar, at the bottom of my screen, which is visible even when the suggestions are displayed.

The problem I am facing is, when there are too many suggestions in the List of the Popup window, it covers my bottom Navigation bar (List is on top of the bottom Navigation bar). I want to prevent this from happening, by giving a margin to the PopupWindows ListView or maybe control the height of the popupWindow. There is an API setDropdownHeight() but there is no marginBottom or a way to limit the bottom part of the view from filling the complete screen.

/**
 * <p>Sets the current height for the auto-complete drop down list. This can
 * be a fixed height, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill
 * the screen, or {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the height
 * of the drop down's content.</p>
 *
 * @param height the height to use
 *
 * @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight
 */
public void setDropDownHeight(int height) {
    mPopup.setHeight(height);
}

The APIs in AutoCompleteTextView gives options to do this for the top/start of this list with APIs like anchor, verticalOffset, etc. But I have not been able to find an API for doing this at the bottom. Is there a way to achieve this?

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Roadblock
  • 2,041
  • 2
  • 24
  • 38

1 Answers1

-1

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

enter code here

Point pointSize = new Point();

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

myAutoCompleteTextView.setDropDownWidth(pointSize.x);

try this method