吐槽-ExpandableListView

吐槽--ExpandableListView? ?需要把ExpandableListView的适配器(继承自BaseExpandableListAdapter)同时绑

吐槽--ExpandableListView

? ?需要把ExpandableListView的适配器(继承自BaseExpandableListAdapter)同时绑定到AutoCompleteTextView,实现搜索过滤功能。实现了接口Filterable,以为成功在即,既然编译抛错误

?

?聪明的java编译器把MyExpandableListAdapter认为是ListAdapter的子类了。怎么办?很简单!一个小技巧让编译器更加聪明点

expandableListView.setAdapter((ExpandableListAdapter)MyExpandableListAdapter);

?至此MyExpandableListAdapter就不仅可以被ExpandableListView使用而且可以被AutoCompleteTextView使用了。

?希望此文对您有用!

?