为一堆TextView实现SearchView

时间:2016-12-26 12:42:13

标签: java android search view

我在TextView内有ActivityScrollViewSearchBar。 我的目标是在ScrollView末尾有TextView,可以搜索SearchView。 我在互联网上找到的教程总是建立一个菜单,这不是我的目标。 是否可以设置此method = function(a) { //use associative array to keep track of the total number of appearances of a value //in the array var counts = []; for(var i = 0; i <= a.length; i++) { if(counts[a[i]] === undefined) { //if the condition is looking for a[0],a[1],a[2],a[3],a[4],a[5] inside counts[] one value at a time and does not find them inside counts[] it will set each value to 1 counts[a[i]] = 1; console.log(counts[a[i]]); } else { return true; } } return false; } ,如果是,如何设置?

圣诞快乐, 儒略。

2 个答案:

答案 0 :(得分:1)

我认为最合适的实现方法是使用SearchView中的Strings作为搜索查询,在菜单中创建TextViews。使用菜单中的SearchView,如果您搜索某些内容并且屏幕上显示的结果多于适合的结果,您可以向下滚动,但仍然可以在屏幕顶部看到您的搜索查询。因此,您无需向上滚动以执行其他搜索。

答案 1 :(得分:0)

请妥善阐述您的问题。如果你想在TextViews的末尾有一个SearchView,那么只需将它添加到你的布局文件中即可。