团购片段中
private SwipeListView mListView;
修改lib_pull库中PullToRefreshListView类
public class PullToRefreshListView extends PullToRefreshAdapterViewBase<SwipeListView> {
private LoadingLayout mHeaderLoadingView;
private LoadingLayout mFooterLoadingView;
protected class InternalListView extends SwipeListView implements EmptyViewMethodAccessor {
private boolean mAddedLvFooter = false;
public InternalListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
PullToRefreshListView继承的PullToRefreshAdapterViewBase<ListView>是一个泛型类,SwipeListView继承自ListView所以可以将SwipeListView作为泛型参数
2. xml中
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/ptr_list"
android:layout_below="@+id/tuangou_actionbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="#19000000"
android:dividerHeight="4dp"
android:fadingEdge="none"
android:fastScrollEnabled="false"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:smoothScrollbar="true"
ptr:ptrDrawableStart="@drawable/refresh_image"
ptr:ptrHeaderTextColor="#C59502"
ptr:swipeBackView="@+id/back"
ptr:swipeCloseAllItemsWhenMoveList="true"
ptr:swipeDrawableChecked="@drawable/choice_selected"
ptr:swipeDrawableUnchecked="@drawable/choice_unselected"
ptr:swipeFrontView="@+id/front"
ptr:swipeMode="both"/>
3、为SwipeListView设置setSwipeListViewListener()监听后,出现setOnItemClick()的事件监听失效
解决办法:重写BaseSwipeListViewListener的onClickFrontView方法
4、滑动删除ListView的行布局对象时,出现行布局对象已被删除,但行布局对象还是显示为向左滑动的状态(显示为向左滑动删除的背景)。
解决办法:
5.SwipeListView的headerView中有ViewPager控件,出现了滑动viewPager控件后,SwipeListView中所有控件的事件监听全部失效
原因:SwipeListView截获了viewPager的滑动事件监听,导致了viewPager滑动无效。
解决办法:创建一个类继承ViewPager, 并重写
使SwipeListView不再抢占焦点
感谢: 国贤、地土、国浈、其鹏、家鑫的帮忙,新博18班这个大集体,我们会一直互助,一起进步
原文地址:http://1137907860.blog.51cto.com/10452906/1675844