Android Question SearchView "dropdown" function

Discussion in 'Android Questions' started by Rusty, May 17, 2019.

  1. Rusty

    Rusty Well-Known Member Licensed User

    Is there a way to add Searchview to a layout i.e. 100dip high; then when the view is touched, resize it to i.e. 500dip (or any percent etc.); allow the user to type/select result; then restore the SearchView back to its original height and display the selected value?
    This is similar to a combobox with dropdown in Visual Studio...

    I'd like to have multiple instances of SearchView; display cities list in one, states list in the other.
    When the user gets focus on the cities, it would expand; allow entry; then contract back.
    Focus would then move to the States list; when focus is gotten there, it would expand; allow entry; then contract back.

    Any advice/example would be greatly appreciated :)
  2. MitchBu

    MitchBu Active Member Licensed User

    You can emulate a combobox dropdown with a button and a listview.

    Make the listview front (use BringToFront if needed), and invisible.

    When you need to view the dropdown, make it visible.

    Use the ItemClick event to detect the user choice and hide the listview.

    Since there is no Esc key to remove the dropdown, clicking on the button again should hide the dropdown when no choice is made.
  3. Erel

    Erel Administrator Staff Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice