android 第三方控件 搜索框,推荐搜索,历史搜索

0

android 第三方控件 搜索框,推荐搜索,历史搜索

 使用方法 ###Add it in your root build.gradle at the end of repositories: allprojects { repositories { ... maven { url "https://jitpack.io" } } }

原文地址:http://www.apkbus.com/blog-927916-77031.html

Add the dependency dependencies { compile 'com.github.chengzipi:Searchbox:v1.0.0' }

举例说明 ##XML #### 属性方法 app:search_hint hint内容 app:search_baground 搜索框背景

Code //历史搜索数据 String shareData = "澳洲美食,长沙美食,韩国料理,日本料理,舌尖上的中国,意大利餐,山西菜"; List skills = Arrays.asList(shareData.split(","));


  1. //热门搜索数据
  2. String shareHotData = "粤菜,浙菜,苏菜";
  3. List skillHots = Arrays.asList(shareHotData.split(","));
  4. this.msearchLy.initData(skills, skillHots, new setSearchCallBackListener() {
  5. public void Search(String str) {
  6. //进行或联网搜索 str搜索关键词
  7. }
  8. public void Back() {
  9. //取消搜索
  10. demo.this.finish();
  11. }
  12. public void ClearOldData() {
  13. //清除历史搜索记录 执行更新本地 原始历史搜索数据
  14. }
  15. public void SaveOldData(ArrayList<String> AlloldDataList) {
  16. //保存所有历史搜索数据 请保保存以便下次使用
  17. }
  18. }