Android zoom processing example code through gesture

It is rumored on the Internet that HTC's hero-rom supports multi touch. Most of the arguments stem from the fact that when browsing web pages and pictures, it can control the size of the page through gestures like iPhone. The following example uses the existing API to realize the zoom function of hero browsing pictures and web pages.

The main principle is the parameter motionevent in the ontouchevent event, which has a getSize () method. In case of one point, the method always returns 0, while in case of two electric shocks, the method returns different values according to the change of the relative position of the two points. We only need to calculate the distance change between two points, and the size of the distance indicates the trend of target change. The geTx () and gety () methods are always located between the two contacts, so we have the trend and target. The rest is to zoom in or out of the target according to the trend.

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