【发布时间】:2012-06-19 11:16:29
【问题描述】:
我已经用下面链接中的直升机绕着它的中心旋转了一个刻度盘:
http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-a-rotating-dialer/
现在我在拨号器旁边有一个图标,我需要围绕拨号器旋转它,同时让拨号器沿圆形路径旋转。
private void rotateLogo(float degrees){
Matrix nMatrix = new Matrix();
Bitmap peopleOrg = BitmapFactory.decodeResource(getResources(), R.drawable.peoplelogo);
float translateX = dialerWidth / 2 - dialerWidth / 2;
float translateY = dialerHeight / 2 - dialerWidth / 2;
nMatrix.preTranslate(-turntable.getWidth()/2, -turntable.getHeight()/2);
nMatrix.postRotate(degrees, translateX, translateY);
nMatrix.postTranslate(turntable.getWidth()/2, turntable.getHeight()/2);
Bitmap peopleScale = Bitmap.createBitmap(peopleOrg, 0, 0, peopleOrg.getWidth(), peopleOrg.getHeight(), nMatrix, true);
peopleLogo.setImageBitmap(peopleScale);
peopleLogo.setImageMatrix(nMatrix);
}
这只会导致图像围绕自己的中心旋转,而不是围绕拨号器的中心点旋转。 我不知道我错在哪里:(
更新
- 我基本上需要徽标在圆形路径中移动并成为可点击的视图。
- 尝试使用 rotateAnim,但视图没有动画,我无法获取 onclick 事件。
- 需要任何可以使用矩阵旋转相同的帮助
【问题讨论】:
-
@userSeven7s 我很抱歉,但我似乎无法弄清楚它会有什么帮助 :( 抱歉
-
旋转后添加图片快照..
-
@userSeven7s : 好吧,标志只是围绕自己的中心旋转,而不是背景图像的中心..
-
您确定徽标在您从 res 加载的图像中完全居中?