ImageView を元の場所と一緒に回転させようとしています (画像とビューを回転させます)。そのため、回転後、回転した画像を現在の位置でクリックすると、回転した場所でのみクリックできるはずです。
このソリューションでは、次のコードを試しています。しかし、回転は順調です。回転が終了したら、回転した場所に ImageView と Image を配置して、そこでのみクリックできるようにする必要があります。しかし、それはうまくいきません。イメージの位置軸ポイントを回転させて正しく配置することができません。この問題を解決する方法を提案してください。
fyi-Gingerbread バージョン 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));
}
});