A method of dragging view in single page floating layer based on Android

In the previous article, we talked about the method of dragging through the official viewdraghelper tool of goolge (see the previous article) https://www.oudahe.com/p/38680/ ), then there is a problem that the ontouchevent in the dragframelayout does not receive the touch message, and the viewdraghelper.trycaptureview method is not triggered when the ontouchevent is used, Therefore, another primitive method is born: it is realized by customizing the draggable view

Main methods:

Initedge: set the initial boundary of the dragging range of the draggable view. Generally, it is the boundary of the parent layout. Note that view. Getleft... Will get 0. I set the boundary and display it when the network data is returned. There is also a way to open a child thread to get.

Ontouchevent: drag calculation and re layout

code:

Layout:

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