Imitate the bilibili search box effect (only three sentences are needed to achieve it)
Take a look at the preview image first (there is a little distortion after conversion):
1. Support search history (already stored in database)
2. The search effect is basically the same as that of bilibili.
3. If you need to modify more content, you can download the library and modify it yourself.
4. I am not an expert. If there is anything wrong, please point it out through Issues. Thank you.
5. Thanks for referring to the article of this po.
6. Thank you for submitting Issues. It’s been so long since I updated. I’m sorry for 8.
With Gradle:
implementation ' com.wenwenwen888:searchbox:1.0.1 '
The first sentence, instantiation:
SearchFragment searchFragment = SearchFragment . newInstance ();
Second sentence, set callback:
searchFragment . setOnSearchClickListener ( new IOnSearchClickListener () {
@ Override
public void OnSearchClick ( String keyword ) {
//这里处理逻辑
Toast . makeText ( ToolBarActivity . this , keyword , Toast . LENGTH_SHORT ). show ();
}
});
The third sentence, display the search box:
searchFragment . showFragment ( getSupportFragmentManager (), SearchFragment . TAG );
Copyright 2016 wenwenwen888
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.