AutoComplete List Position

0

How to position the list of AutoCompleteTextView below the same ?, I have seen some tutorials and simply the list starts below plus mine is at the top.

<AutoCompleteTextViewandroid:id="@+id/actViewEqp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    android:completionThreshold="2"
    android:dropDownHeight="200dp"
    android:dropDownWidth="match_parent"
    android:ems="10"
    android:hint="ID do equipamento" />
    
asked by anonymous 29.09.2017 / 22:40

1 answer

2

By default, the options list for AutoCompleteTextView is positioned below view if you have enough space. If that does not happen, it will do exactly what is happening to you.

The android:dropDownHeight="200dp" property defines exactly what the basic height of your drop-down list will be. If you set this size to 200dp , it will look for a space equivalent to below to show the contents of the list, otherwise its behavior will not be even as expected, making it appear above the view .

You can adjust this size so that it is only 50dp , for example, causing it to show fewer options for the user, however this forces you to fill in more text field. It is also possible to password a flexible size if you use the wrap_content property. This will make your dropdown list occupy the minimum possible size based on your content.

Read more details here in the documentation .

    
29.09.2017 / 23:26