Detailed explanation of functions and usage of Android search view

Searchview is a search box component that allows users to enter text in the text box and obtain the user's input through the listener. When the user clicks search, the listener performs the actual search.

1. Common methods of searchview component are as follows:

① Seticonfiredbydefault (Boolean icon) = = > set whether the search box is automatically reduced to an icon by default. ② Setonquerytextlistener (searchview, onquerytextlistener) = = > set the listener for the search box ③ setsubmitbuttonenabled (Boolean enabled) = = = > set whether to display the search button ④ setqueryhint (charsequence hint) = = = > set the default displayed prompt text in the search box

2. Adding a supporting listview to searchview can add the function of automatic completion, that is, listview is used to display the automatic replenishment list for searchview

3. The specific implementation code is as follows:

html

java

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>