سؤال

I am animating a view with translate animation but it is behaving strange at 1 situation among 6. I am having a single view which to be added left or right (one at a time ) with proper animation as inFromLeft/outToRight/etc. For an example If my view is available at left and i want to animate it to left using left handle then out to left animation will take place which is handled properly in my code . Similarly if my view is available in right and i want to animate it using left then steps to be followed as :

(1)out from right animation and remove from right.

(2) add to left and in from left animation

This is again right in my code.

But for the similar case but reverse in current position as

if my view is in left and i want to animate the view from right handle then steps to be followed as:

(1) Out to left animation and remove from left view group then

(2) adding it to right and then in From right animation.

when i am doing this its not animating properly.

Pictorial view of Steps i Followed

also adding image link Image link for step i followed

I am attaching my application code , please tell me what wrong i am doing for this particular situation Link for complete src code

هل كانت مفيدة؟

المحلول

In my case i am using Thread.sleep(longTime) for 2 consecutive animation but its was creating problem. I did it using Handler with postDelayed(longtime) as follows which was doing directly in onAnimationEnd().

 new Handler().postDelayed(new Runnable() {
  @Override
  public void run() {
    inFromRight();
  }
 }, 100);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top