【问题标题】:How to Rotate or Scale ImageView with Image?如何使用图像旋转或缩放 ImageView?
【发布时间】:2011-11-12 04:11:58
【问题描述】:

如何使用图像旋转或缩放图像视图? Image View 的 Size 是 Wrap_Content 和 Rotate or Scale Image on Touch Event of Image view。

请帮帮我。

【问题讨论】:

    标签: android image-scaling image-resizing android-imageview image-rotation


    【解决方案1】:

    您可以在 ImageView 上使用Animation。下面是一个旋转动画的例子:

        Animation anim = new RotateAnimation(0, ANGLE, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        anim.setDuration(DURATION);
        anim.setRepeatCount(0);
        anim.setFillAfter(true);
        image_view.startAnimation(anim);        
    

    您可以为缩放和平移动画找到类似的解决方案。如果您不想看到动画,请将持续时间设置为零。 setFillAfter 很重要,如果您不想在动画后重置图像。祝你好运

    【讨论】:

    • 请查看我已编辑的问题。
    • 您希望通过触摸事件实现什么效果?只是为了启动旋转,调整后缩放或通过一些手势监听器修改旋转角度和缩放,包括多点触控?你的问题不是很清楚。
    • 不是多点触控我只完成了图像的旋转、图像的缩放和放大、图像的触摸事件中的图像缩小,但问题是我当时是放大还是缩小图像唯一的图像是放大或缩小而不是图像视图。所以如何放大、缩小、缩放和旋转图像视图。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-08
    • 1970-01-01
    • 1970-01-01
    • 2012-12-19
    • 2018-10-17
    相关资源
    最近更新 更多