我用庫列表視圖中拉片段刷新,這是非常好的圖書館: 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