我想旋转ImageView以及其原始位置(旋转图像以及视图)。所以,旋转后,当我点击旋转的图像在其当前位置,它应该只能在旋转的位置单击。旋转ImageVIew应该在Android下面的旋转位置点击HoneyComb版本
对于此解决方案,我尝试下面的代码。然而它正在旋转很好。旋转结束后,我需要将ImageView和Image放置在旋转的位置,使其只能在那里点击。但是它没有成功。我无法将图像位置轴点旋转到正确位置。任何人都可以请建议一种方法来解决这个问题。
仅供参考,它应该在姜饼Android版本 - 9
aniView1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("", "Clicked on IMAGE VIEW - 1");
}
});
RotateAnimation rotate5 = new RotateAnimation(0, 150,
Animation.INFINITE, 100, Animation.INFINITE, 250);
//rotate5.setFillAfter(true);
rotate5.setDuration(2000);
rotate5.setInterpolator(new LinearInterpolator());
aniView1.setAnimation(rotate5);
rotate5.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
int newTop = (int) (aniView1.getTop() + aniView1.getWidth());
aniView1.layout(aniView1.getLeft()-200, newTop,
aniView1.getRight(),
aniView1.getBottom() + aniView1.getMeasuredWidth());
// aniView1.setLayoutParams(new
// RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
}
});
没有老板,我旋转的图像也应该被点击,这意味着完整的图像以及视图应该完全从原始位置到旋转位置 – candy
请检查编辑答案,我只能点击该位置的旋转图像。希望它适用于您的情况 –
请更改360以外的旋转度并尝试?在你上面的代码中,你正在旋转到相同的位置。请尝试其他情况下30 60 90 120度360以下,并尝试让我知道 – candy