我已经按照以下链接的方法,围绕一个中心旋转了一个拨号盘:
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事件。
- 希望能通过矩阵旋转相同的任何帮助