没有自定义过滤器的ListView过滤

时间:2015-01-19 16:25:23

标签: android listview filter

我获得了filter listview的代码,如下所示。但它没有考虑中间词。 我可以通过包含没有自定义过滤器的单词进行过滤。

ListView listView;

String[] from = { "php_key","c_key","android_key","hacking_key" };

ArrayAdapter arrayAdapter;

listView = (ListView) findViewById(R.id.zone_list); 

arrayAdapter = new ArrayAdapter(this,R.layout.setlanguage, R.id.tvName, from);

listView.setAdapter(arrayAdapter); 

1 个答案:

答案 0 :(得分:0)

我得到了答案。首先在数组中搜索然后setAdapter。

       ListView listView;

    String[] from = { "php_key","c_key","android_key","hacking_key" };

    ArrayAdapter arrayAdapter;

    listView = (ListView) findViewById(R.id.zone_list); 

    arrayAdapter = new ArrayAdapter(this,R.layout.setlanguage, R.id.tvName, from);

If(from.contains("search text")){

    listView.setAdapter(arrayAdapter);
}