標籤:滑動刪除(swipelistview)
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/6F/D0/wKiom1WpNU-yOeTrAAGRJhRvb-Q076.jpg" title="滑動刪除.png" alt="wKiom1WpNU-yOeTrAAGRJhRvb-Q076.jpg" />
團購片段中
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方法
650) this.width=650;" src="http://note.youdao.com/yws/public/resource/2f5eb7762b2dbed24c52e5997cdb910a/7C18C89EF638439FB006D3BE2CAAC88B" style="border:none;line-height:1.5;width:577.6451612903227px;height:auto;" alt="7C18C89EF638439FB006D3BE2CAAC88B" />
4、滑動刪除ListView的行布局對象時,出現行布局對象已被刪除,但行布局對象還是顯示為向左滑動的狀態(顯示為向左滑動刪除的背景)。
解決辦法:650) this.width=650;" src="http://note.youdao.com/yws/public/resource/2f5eb7762b2dbed24c52e5997cdb910a/C4EED69CBB43413FB4E74910C90B2CEC" style="border:none;line-height:1.5;height:auto;width:672.4637681159419px;" alt="C4EED69CBB43413FB4E74910C90B2CEC" />
5.SwipeListView的headerView中有ViewPager控制項,出現了滑動viewPager控制項後,SwipeListView中所有控制項的事件監聽全部失效
原因:SwipeListView截獲了viewPager的滑動事件監聽,導致了viewPager滑動無效。
650) this.width=650;" src="http://note.youdao.com/yws/public/resource/2f5eb7762b2dbed24c52e5997cdb910a/D755B8F8B0C9481EACE1F700360E936F" style="border:none;line-height:1.5;height:auto;width:622.2222222222222px;" alt="D755B8F8B0C9481EACE1F700360E936F" />
解決辦法:建立一個類繼承ViewPager, 並重寫650) this.width=650;" src="http://note.youdao.com/yws/public/resource/2f5eb7762b2dbed24c52e5997cdb910a/D91EAB129F0E46F5A3E7D8282F7F1D6B" style="border:none;line-height:1.5;height:auto;width:510.00000000000006px;" alt="D91EAB129F0E46F5A3E7D8282F7F1D6B" />
使SwipeListView不再搶佔焦點
感謝: 國賢、地土、國湞、其鵬、家鑫的幫忙,新博18班這個大集體,我們會一直互助,一起進步
cc美團 滑動刪除(SwipeListView)