首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

吐槽-ExpandableListView

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

吐槽--ExpandableListView

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

?

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

expandableListView.setAdapter((ExpandableListAdapter)MyExpandableListAdapter);

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

?希望此文对您有用!

?

热点排行