Android imitation QQ left slide delete top listview operation

I have nothing to do recently, so I studied the left sliding deletion effect of QQ and tried to realize it. First, I put on the effect picture:

General idea and principle: - display and hide the menu by setting margin - listen to ontouchevent and handle sliding events

Upper code

Pay attention to the layout of item. Because what is written in the custom view is to obtain the first sub layout as the display content, it is necessary to write the display style in one container and the menu in another container. There are two parallel relationships. The XML file is defined as follows:

Finally, delete and set the top. This is relatively simple. Add a click event to the button. I define the implementation in the adapter. Remember to turn off the menu after operation!

Upper part code:

Finally, there is another remaining problem. When the listview slides left and right, it will slide up and down. This needs to be explored and improved. I also hope you can put forward your opinions and help me improve!

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