我正试图通过手指触摸来旋转ImageView
。
但目前它正从图像的中心点旋转圆形。
public boolean onTouch(final View v, MotionEvent event) {
wheel.setRotation((int)event.getRawX());
}
答案 0 :(得分:0)
在onClickListener中尝试使用此代码。
RotateAnimation rotateImage = new RotateAnimation(0.0f, 90,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 1f);
rotateImage.setStartOffset(0);
rotateImage.setDuration(1500);
rotateImage.setFillAfter(true);
rotateImage.setInterpolator(YourActivity.this, android.R.anim.decelerate_interpolator);
imageView.startAnimation(rotateImage);