private PullToRefreshExpandableListView lv; lv = (PullToRefreshExpandableListView) findViewById(R.id.lv); lv.setAdapter(new MyAdapter(this,list));
今天使用PullToRefreshExpandableListView做带下拉的二级列表,开始用的ExpandableListView,后来集成了下拉刷新后发现好多方法都不对了,其中最有代表性的就是setAdapter不能用了,因为PullToRefreshExpandableListView的setAdapter必须使用ListAdapter,而ExpandableListView一般用BaseExpandableListAdapter。
解决方法:加上getRefreshableView()就可以了
private PullToRefreshExpandableListView lv; lv = (PullToRefreshExpandableListView) findViewById(R.id.lv); lv.getRefreshableView().setAdapter(new MyAdapter(this,list));