Key points analysis of sliding deletion effect of listview imitating QQ in Android App

It was originally intended to set a hidden button on the layout of each item in the listview, which will be displayed when sliding. However, because there is only one button at a time, it is found that the buttons on each item are difficult to control each other. So I decided to inherit listview and combine it with popupwindow. The first is the layout file: delete_ Btn.xml: only one button is needed here

Main layout file: activity_ Main.xml, the style of each item in the listview directly uses android.r.layout.simple of the system_ list_ item_ one

Next, let's look at the implementation of qqlistview:

The code comments are written in detail. To put it simply, set whether to respond to user sliding in dispatchtouchevent, and then judge whether to respond in ontouchevent. If so, popwindow will be displayed in the form of animation. Of course, if there is a popupwindow on the screen, the scrolling of the screen listview, the clicking of the item, and the click event of the screen item when sliding from right to left. The next step is mainactivity. Java. The code here is very simple. I won't introduce it.

The effect is too laggy. The effect is as follows: landlord uses asm.jar and gifcamera cut GIF, because button animation is very short, feel the screenshots effect is very not smooth, what good screenshots do you have, and hope to recommend. Interested or download the source code to see the effect I.

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
分享
二维码
< <上一篇
下一篇>>