Highlight instances in Android search results (with data sliding and automatic refresh at the bottom)
First, the renderings of
Search results (here I just simulate the data, and the returned data should contain keywords when it is really running with the server)
Simulated interface without search results
Concrete implementation
I'd like to add a word here, which is to do one thing and split it into multiple summaries, so as not to be confused during development, but also to control the progress of development
The idea is actually very simple. We monitor the changes in the input box, then request the server after the text changes, and then get the results we need for data display
Step 1: monitor the search box
Step 2: make relevant logical requests
Step 3: change color
Demo description
The local JSON here is artificially defined by me, and I added my own logic during the search. If it needs to be changed according to my own needs in the actual project, I don't need to care about the relevant display. Here is just an idea to realize the search and highlight the keywords.
Demo code portal: https://github.com/wuyinlei/SearchViewDemo
Download address: searchviewdemo_ jb51.rar
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.