gpt4 book ai didi

android - 搜索 View 和可过滤 : Showing a bar with searched text

转载 作者:行者123 更新时间:2023-11-29 20:22:33 25 4
gpt4 key购买 nike

我正在使用 SearchViewListView 并实现 Filterable 来过滤记录。除了两个问题外,它工作正常。

问题是:

  1. 当我在 SearchView 中写东西时,会出现一个显示搜索文本的黑条。
  2. 箭头 (>) 符号在 SearchView 的右边缘也可见。

我想删除两者。我怎样才能删除它们?

这是问题的图片。 enter image description here

最佳答案

试试这个弹窗

在您的 ListView 上禁用 TextFilterEnabled

yourListView.setTextFilterEnabled(false);

像这样过滤你的数据:

android.widget.Filter filter = yourListAdapter.getFilter();

同时添加:

@Override
public boolean onQueryTextChange(String newText) {
System.out.println("tap");
yourAdapter ca = (yourAdapter)listview.getAdapter();

if (TextUtils.isEmpty(newText)) {

listview.clearTextFilter();

} else {

filter.filter(newText);


}
return true;
}

关于android - 搜索 View 和可过滤 : Showing a bar with searched text,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32986217/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com