【发布时间】:2015-04-13 02:30:14
【问题描述】:
我有一个带有多个EditTexts 的自定义ListView,我想让搜索功能只使用EditTexts 之一。
到目前为止,我能够在ActionBar 上实现SearchView,但我不知道如何使用 onQueryTextChange/Submit 方法在我的 SQLite 数据库中进行搜索。
我在 youtube 和 google 上查看了所有内容,但绝对找不到任何对使用自定义列表视图有明确帮助的内容。我能够找到一些关于使用没有 SQLite 数据的简单列表视图的好例子,但我不知道如何使它们适应我的情况......我真的需要帮助!!
如果您需要任何其他信息,请随时询问,我会立即发布。非常感谢!
代码
我的 customAdapter 视图
public View getView(int position, View view, ViewGroup parent) {
Cliente cliente = lista.get(position);
if(view == null)
{
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.single_row_listar_cliente, null);
}
TextView txtNome = (TextView) view.findViewById(R.id.tv_cliente_nome);
txtNome.setText(cliente.getNome());
TextView txtSobrenome = (TextView) view.findViewById(R.id.tv_cliente_sobrenome);
txtSobrenome.setText(cliente.getSobrenome());
//
Button btn = (Button) view.findViewById(R.id.btn_cliente_opcoes);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d("working", "k");
//Mensagem.Msg(ListarCliente, "oi",1000);
}
});
return view;
}
【问题讨论】:
-
使用游标适配器见Tutorial
-
Harry,请将其作为答案发布,以便我选择您作为最佳答案。谢谢!
标签: android android-actionbar searchview