Android实现图片顺时逆时旋转及拖拽显示效果

2014-11-24 14:34:38 · 作者: · 浏览: 5

1、首先说一下两个类:




The Matrix class holds a 3x3 matrix for transforming coordinates. Matrix does not have a constructor, so it must be explicitly initialized using either reset() - to construct an identity matrix, or one of the set..() functions (e.g. setTranslate, setRotate, etc.).


接下来我们用到了两个方法:


平移方法:两个参数分别是要移到的x、y坐标








PointF holds two float coordinates


我们要用到该类的一个方法:设置点的x和y坐标




首先看一下效果图:


旋转拖拽后


布局很简单在此不再给出!直接看java代码:





Interface definition for a callback to be invoked when a touch event is dispatched to this view. The callback will be invoked before the touch event is given to the view.


接口定义作为一个回调函数被调用时被派遣去触摸事件这一观点。回调函数被调用之前会触摸事件是给你尽情的观看。