java Android:“setTextFilterEnabled”方法有什么作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1942421/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android: what does "setTextFilterEnabled" method do?
提问by Nicholas Key
What does the setTextFilterEnabled()method do?
什么是setTextFilterEnabled()方法呢?
采纳答案by Chris Thompson
It basically enables filtering for the contents of the given ListView. However, the caveat, as explained hereis that the filtering doesn't happen automatically. According to that link, you have to provide the filtering logic and then according to the AbsListView docs that outline that method, the adapter you call that method on must also implement Filterable.
它基本上可以过滤给定 ListView 的内容。但是,需要注意的是,正如此处所解释的,过滤不会自动发生。根据该链接,您必须提供过滤逻辑,然后根据概述该方法的 AbsListView 文档,您调用该方法的适配器也必须实现Filterable。
Hope that helps...
希望有帮助...
回答by CharlieP
According to the Android Developer Reference, the setTextFilterEnabled() method "enables or disables the type filter window. If enabled, typing when this view has focus will filter the children to match the users input."
根据 Android Developer Reference,setTextFilterEnabled() 方法“启用或禁用类型过滤器窗口。如果启用,在此视图具有焦点时输入将过滤子项以匹配用户输入。”
Source and extra information can be found at the Android Developer Reference, ie : http://developer.android.com/reference/android/widget/AbsListView.html#setTextFilterEnabled%28boolean%29
可以在 Android Developer Reference 中找到源代码和额外信息,即:http: //developer.android.com/reference/android/widget/AbsListView.html#setTextFilterEnabled%28boolean%29
回答by CharlieP
It is used for filtering the contents of the given ListView .when you type a letter then you will be automatically scrolled to that item if it is there in that view .
它用于过滤给定 ListView 的内容。当您键入一个字母时,如果它在该视图中,您将自动滚动到该项目。

