梵蒂冈之花
为此,您首先需要添加一个edittext,在其中键入以过滤列表中的数据,然后在列表中启用过滤,editText = (EditText) findViewById(R.id.searchList); adapter = new CustomListViewAdapter(this, R.layout.list_row, rowItems); listView.setAdapter(adapter); listView.setTextFilterEnabled(true);然后,您需要TextChangeListener()为edittext 添加,editText.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { } public void afterTextChanged(Editable arg0) { MyActivityName.this.adapter.getFilter().filter(arg0); } });