我用库列表视图中拉片段刷新,这是非常好的图书馆: https://github.com/chrisbanes/Android-PullToRefresh使用PullToRefreshExpandableListView在片段
现在我想用PullToRefreshExpandableListView。我查看了示例代码,并对活动进行了很好的解释。现在我想在片段中使用它。但我有问题。下面我在活动写一些部件条码是由图书馆出版社做的,我的片段
代码 在活动使用PullToRefreshExpandableListView
原始代码:
class PullToRefreshExpandableListActivity extends
ExpandableListActivity {
//created mAdapter (SimpleExpandableListAdapter)
//inflated mPullRefreshListView (PullToRefreshExpandableListView)
//and setListAdapter(mAdapter);
}
一切OK!
和在我的代码
片段类创建,onCreateView方法充气PullToRefreshExpandableListView,创建mAdapter如上代码。 但是,当我想设置适配器,还有就是我的问题:(
代码:
mPullRefreshListView.setAdapter(mAdapter);
编译错误:
The method setAdapter(ListAdapter) in the type PullToRefreshAdapterViewBase<ExpandableListView> is not applicable for the arguments (SimpleExpandableListAdapter)
所以,如果你知道如何使用片段PullToRefreshExpandableListView
,请请帮忙写下如何设置适配器。
谢谢
如何使用的?你是否从主碎片扩展了ListFragment? – Maxrunner