ITPub博客

首页 > IT职业 > IT生活 > android搜索框,推荐搜索,历史搜索

android搜索框,推荐搜索,历史搜索

IT生活 作者:zhjhome 时间:2021-09-09 09:47:55 0 删除 编辑

图片描述

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

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(","));

    //热门搜索数据
    String shareHotData = "粤菜,浙菜,苏菜";
    List skillHots = Arrays.asList(shareHotData.split(","));    this.msearchLy.initData(skills, skillHots, new setSearchCallBackListener() {        public void Search(String str) {          //进行或联网搜索  str搜索关键词
        }        public void Back() {            //取消搜索
            demo.this.finish();
        }        public void ClearOldData() {          //清除历史搜索记录  执行更新本地 原始历史搜索数据
        }        public void SaveOldData(ArrayList AlloldDataList) {            //保存所有历史搜索数据  请保保存以便下次使用
        }
    }

原文链接:http://www.apkbus.com/blog-927916-77031.html

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/2530/viewspace-2812579/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-16

  • 博文量
    102
  • 访问量
    950