繁体   English   中英

如何在Android中通过触摸旋转图像视图并增加图像视图的宽度

[英]How to rotate an imageview by touch in android & also increase the width of the imageview

我正在尝试通过手指触摸来旋转ImageView 在此处输入图片说明

但目前它是从图片的中心点旋转成圆形。

public boolean onTouch(final View v, MotionEvent event) {
    wheel.setRotation((int)event.getRawX());
} 

在您的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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM