Android Question SearchView "dropdown" function

Rusty

Well-Known Member
Licensed User
Longtime 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 :)
Rusty
 

MitchBu

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Consider using MiniSearchView: https://www.b4x.com/android/forum/threads/b4x-xui-minisearchview-autocomplete-field.93564/

SS-2018-05-29_15.28.34.png


The list is automatically hidden after the user selects an item: https://www.b4x.com/android/forum/t...ve-to-autocompleteedittext.19379/#post-111667
 
Upvote 0
Top