zoukankan      html  css  js  c++  java
  • 去除searchView的黑框去除

    有黑框的效果

    关键代码:在onQueryTextChange使用默认的setFilterText(newText);进行过滤导致

        // 用户输入字符时激发该方法
        @Override
        public boolean onQueryTextChange(String newText) {
            if (TextUtils.isEmpty(newText)) {
                // 清除ListView的过滤
                lv.clearTextFilter();
            } else {
                // 使用用户输入的内容对ListView的列表项进行过滤
                lv.setFilterText(newText);
            }
            return true;
        }

    解决方法:在onQueryTextChange不使用默认的setFilterText(newText);改为使用adapter.getFilter().filter(newText)进行过滤导致

        // 用户输入字符时激发该方法
        @Override
        public boolean onQueryTextChange(String newText) {
            if (TextUtils.isEmpty(newText)) {
                // 清除ListView的过滤
                lv.clearTextFilter();
            } else {
                // 使用用户输入的内容对ListView的列表项进行过滤
                adapter.getFilter().filter(newText);//通过适配器过滤
            }
            return true;
        }
    
  • 相关阅读:
    P2622 关灯问题II(关灯问题)
    P1140 相似基因
    Choose and Divide UVa 10375
    Disgruntled Judge UVA
    Color Length UVA
    P1052 过河
    P1026 统计单词个数
    Balanced Number HDU
    The SetStack Computer UVA
    Urban Elevations UVA
  • 原文地址:https://www.cnblogs.com/hahayixiao/p/12096688.html
Copyright © 2011-2022 走看看