dim*_*til 8 android pull-to-refresh
有没有人有使用Pull to refresh列表的做法Pinned section header?我使用Android-PullToRefresh lib和我的列表,我想添加在列表顶部显示固定节标题的功能.我在另一个项目中使用了PinnedHeaderListView lib来获取固定部分.但我无法将这两个库合二为一.
Android-PullToRefresh是否可以显示固定部分标题?也许任何其他Pull to refreshlib都可以做到吗?
小智 9
可以将Actionbar-PullToRefresh库与StickyListHeaders库集成,但是您需要使用自定义Delegate才能使Actionbar-PullToRefresh正常工作:
public class StickyListViewDelegate extends AbsListViewDelegate {
@Override public boolean isReadyForPull(View view, final float x, final float y) {
StickyListHeadersListView sticky = (StickyListHeadersListView) view;
return super.isReadyForPull(sticky.getWrappedList(), x, y);
}
Run Code Online (Sandbox Code Playgroud)
整合如下:
StickyListViewDelegate delegate = new StickyListViewDelegate();
ActionBarPullToRefresh.from(getActivity()).theseChildrenArePullable(mListView)
.useViewDelegate(StickyListHeadersListView.class, delegate)
.listener(this).setup(mPullToRefreshLayout);
Run Code Online (Sandbox Code Playgroud)
这两个库不能一起工作的原因是因为StickyListHeadersListView类实际上并没有扩展ListView(这是Actionbar-PullToRefresh库在默认情况下分配委托时所查找的内容).
我做了一些研究,发现了两种替代方案:
您可以尝试将这两个库与 ActionBar-PullToRefresh 结合起来。我想你可以实施该解决方案;)
| 归档时间: |
|
| 查看次数: |
4089 次 |
| 最近记录: |