Explain swipelistview framework in detail to realize wechat \ QQ sliding deletion effect

There has been a slide on QQ or wechat. The recent contact list can delete the currently selected contact. This function is great.

Just tried to do it. In fact, it uses the open source framework swipelistview.

Swipelistview is similar to the general listview, but some special functions are added.

• swipefrontview - the control ID normally displayed by the listview item, which must be the same as the control ID in the item's layout file • swipebackview - the control ID displayed when the finger slides, hidden behind the frontview, and must be the same as the control ID in the item's layout file • swipeactionleft - the action of sliding left, which is the default review, that is, the backview and disassis, • the method by which choice triggers the response Swipeactionright - right sliding action, the others are the same as above • swipemode - default: 'both' setting of left sliding and right sliding are supported • swipeclosealltimeswhenmovelist - when scrolling listview, close all expanded items. It is better not to set it to false. Due to the reuse of items, false has some problems. • Swipeopenonlongpress - default: 'true' long time trigger display • swipeanimationtime - animation time length • swipeoffsetleft - left offset • swipeoffsetright - right offset

The use method is very simple, similar to an ordinary listview, and there is no need to say more.

To delete a single element from an item in a listview, you only need to handle the button click event in the adapter or write a callback back to the activity for processing

Here I give the code of the processing method in the adapter:

Source code download: https://github.com/honjane/SwipeListViewDemo

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>