I have a TranslateAnimation that shall animate a LinearLayout
(isScrollContainer) to the left and to the right along the x-axis. The
animation to the left works and the animation is straight - means that
the view is animated horizontally only.
But the animation left to right doesn't work: instead of just moving the
view from left to right along the x-axis, the view gets animated into
the screen from diagonal lower-right corner. But for the Y parameters I
pass fixed identical values.
Here is a flv movie that shows the animation and issue I described:
http://tinyurl.com/24n4eac
Code as follows:
View v = ((MainSlide)mCtx).activityFrame; // my view to scroll/animate
Animation mBounceAnim;
// animate to left edge - this one works fine!
mBounceAnim = new TranslateAnimation(
Animation.ABSOLUTE,
v.getScrollX(), // is somewhere between 0 - 239
Animation.ABSOLUTE,
v.getScrollY(),
Animation.ABSOLUTE,
0,
Animation.ABSOLUTE,
v.getScrollY()
);
// ======================================
// *** THIS ONE DOESN'T WORK PROPERLY ***
// ======================================
// animate to right edge
mBounceAnim = new TranslateAnimation(
Animation.ABSOLUTE,
v.getScrollX(), // is somewhere between 240 - 480
Animation.ABSOLUTE,
v.getScrollY(),
Animation.ABSOLUTE,
((View)this.getParent()).getWidth(), // in my case is 480
Animation.ABSOLUTE,
v.getScrollY()
);
}
mBounceAnim.setDuration(600);
mBounceAnim.setFillBefore(false);
mBounceAnim.setFillAfter(true);
mBounceAnim.setInterpolator(new BounceInterpolator());
v.startAnimation(mBounceAnim);
The view I'm animating is this:
<LinearLayout
android:id="@+id/frame"
android:orientation="horizontal"
android:layout_width="960dp"
android:isScrollContainer="true"
android:layout_height="wrap_content"/>
(which is part of an ActivityGroup, where the LinearLayout holds the
decorView of the activities; not sure if this matters in any way).
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en