0
私はあなたの助けが必要です:) 私はEditTextを持ち、ExpandableListViewの下にあります。私はグループ/子供とBaseExpandableListAdapterを使用しています。私は、ユーザーがEditTextに書き込むとき、ExpandableListViewはテキストが挿入されたグループ(アイテム)のみを表示したいと思います。 私はフィルタを作成する必要があると思います。 ここに私のソースコードがあります。誰か助けてくれませんか?BaseExpandableListAdapterを使用したExpandableListViewのテキストのフィルタ
class MyExpandableListAdapter extends BaseExpandableListAdapter implements Filterable{
をしてから、私はされるgetFilter()メソッドをオーバーライドします:事前に
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState
setContentView(R.layout.main);
et = (EditText) findViewById(R.id.filterText);
et.setSingleLine();
et.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
if (et.getText().toString().equals(""))
elv.setBackgroundColor(Color.BLACK);
else
{
elv.setBackgroundColor(Color.WHITE);
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
elv=getExpandableListView();
mAdapter = new MyExpandableListAdapter(fields_select,description);
elv.setAdapter(mAdapter);
class MyExpandableListAdapter extends BaseExpandableListAdapter {
......
}
回答を正しいとマークすることができます。 – SERPRO