android中翻译动画imageView的onTouchlistner onTouchlistner未在“平移动画图像视图”上工作。在动画过程中,实际视图不会移动,其中仅对图像的副本进行了动画处理。请告诉我如何将touchevent添加到动画图像视图中。

android中翻译动画imageView的onTouchlistner onTouchlistner未在“平移动画图像视图”上工作。在动画过程中,实际视图不会移动,其中仅对图像的副本进行了动画处理。请告诉我如何将touchevent添加到动画图像视图中。,android,android-animation,android-event,Android,Android Animation,Android Event,android中翻译动画imageView的onTouchlistner onTouchlistner未在“平移动画图像视图”上工作。在动画过程中,实际视图不会移动,其中仅对图像的副本进行了动画处理。请告诉我如何将touchevent添加到动画图像视图中。请在下面找到相同的代码。 视图动画实际上不能移动视图,相反,您应该使用属性动画,我需要为android api 7级提供支持,而属性动画不存在。任何克服此问题的其他方法我尝试使用NineoDandroid库仍然无法成功。请查找下面的代码。

android中翻译动画imageView的onTouchlistner onTouchlistner未在“平移动画图像视图”上工作。在动画过程中,实际视图不会移动,其中仅对图像的副本进行了动画处理。请告诉我如何将touchevent添加到动画图像视图中。请在下面找到相同的代码。
视图动画实际上不能移动视图,相反,您应该使用属性动画,我需要为android api 7级提供支持,而属性动画不存在。任何克服此问题的其他方法我尝试使用NineoDandroid库仍然无法成功。请查找下面的代码。
                **activity class**


  public class AnimationAndroid extends Activity implements OnTouchListener {
                /** Called when the activity is first created. */
                ImageView viewOne; /* image view */
                Animation aOne;
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
                    viewOne = (ImageView) findViewById(R.id.viewone); /* to get image view */
                    aOne = AnimationUtils.loadAnimation(this, R.anim.animatextone);   /* initializing the animation from xml file */
                    viewOne.setOnTouchListener(this); /* onTouch listner on imageView */
                    viewOne.startAnimation(aOne); /* to start animation */
                }

                public boolean onTouch(View v, MotionEvent event) { 
/* onTouch event function*/
                      Toast.makeText(AnimationAndroid.this, "Image One",Toast.LENGTH_SHORT).show(); /* to display the toast message on touch */
                }
         }


                **Animation xml file code** 




 <?xml version="1.0" encoding="utf-8"?>
            <set xmlns:android="http://schemas.android.com/apk/res/android"
                android:shareInterpolator="false">
               <translate
                android:fromXDelta="20%p"
                android:fromYDelta="20%p"
                android:duration="28000"
                android:repeatMode="reverse"
                android:repeatCount="infinite"
                android:toXDelta="28%p"
                android:toYDelta="18%p" 
                android:fillAfter="false"   
                />
            </set>

        Please let me know how i can resolve the issue. I need to have infinite
        animation.still onClick on the animated image is not working.
        **animation using nineoldandroid library**

       Implementation using nineoldandroid library but still not able to succeed.
       The click on animated moving image is not triggering the event.
       Please let me if am going wrong in implementing the nanooldandroid library   



public class NineOldTesting extends Activity implements OnClickListener{
       /* Called when the activity is first created. */
       final int duration = 2 * 15000;  /* duration of animation */
       @Override
       public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);  
           setContentView(R.layout.main);
           ImageView tv = (ImageView) findViewById(R.id.testView); /* imageview id*/
           AnimatorSet set = new AnimatorSet();   /* to do animation together */
           set.playTogether(
               ObjectAnimator.ofFloat(tv, "translationX", 0, 90),
               ObjectAnimator.ofFloat(tv, "translationY", 0, 90)
           ); /* to move image in x and y direction */
           set.setDuration(duration);  /*  to set duration of animation */
           set.start(); /* start animation */
           tv.setOnClickListener(this);  /* setting onclick listner for image view*/
       }
       @Override
       public void onClick(View v) {
           /* TODO Auto-generated method stub */
           Toast.makeText(getApplicationContext(), "hiiiiii", Toast.LENGTH_SHORT).show(); /* to display toast message on click*/
       }
   }