是否有一个用于处理Android的捏缩放功能内置的API缩放、有一个、功能、API

2023-09-12 09:26:59 作者:贱人总爱装纯装可怜

我只是想知道是否有某种类来采用Android 2.1的多点触控功能。具体来说,我想实现捏缩放和在想,如果我总是要衡量两个触摸事件之间的距离,计算出在我自己的缩放级别?

I just wanted to know if there is some kind of class to use the multitouch features of android 2.1. Specifically I am trying to implement pinch-zoom and was wondering if I always have to measure the distance between two touch events and calculate the zoom level on my own?

谢谢, 克里斯

推荐答案

我试图做同样的事情,和往常一样我的第一反应是寻找到C本身的Andr​​oid源$ C ​​$。有趣的位似乎是在类ScaleGestureDetector,这是不公开的,但它的javadoc说:

I'm trying to do the same thing, and as usual my first instinct was to look into the Android source code itself. The interesting bits seem to be in class ScaleGestureDetector, which is not public but its javadoc says

@hide待API批准

@hide Pending API approval

所以希望它会在某些时候成为公众。

so hopefully it will become public at some point.

更新:ScaleGestureDetector现在是Android 2.2的API的一部分。

Update: ScaleGestureDetector is now part of the Android 2.2 API.