Thanks for your answer Daniel.
I had some difficulties to understand but finally, it works !
Thanks a lot.
The key point is to display the final result then make an animation that
start from a negative position to 0.
In my case, it works without having to use "post" ...
Mike
daniel.benedykt a écrit :
> Hi Mike
>
> Actually I just got the solution :)
> I was having this problem for a couple of days but just solved it.
>
> Here is the solution:
>
> When you want to animate from left to write do this:
>
> absoluteLayout.post(new SwapViewsDifferent());
>
> then you have a inner class:
>
> private final class SwapViewsDifferent implements Runnable {
>
> public void run() {
> //first it scrolls, so android see the screen.
> absoluteLayout.scrollBy(screenWidth * -1, 0);
> //then the *animation* a little different from
> yours. compare the values
> *Animation **animation* = new
> TranslateAnimation(*Animation*.ABSOLUTE,
> -screenWidth,
> *Animation*.ABSOLUTE, 0, *Animation*.ABSOLUTE, 0,
> *Animation*.ABSOLUTE, 0);
> *animation*.setDuration(500);
> *animation*.setFillAfter(false);
> absoluteLayout.startAnimation(*animation*);
> }
> };
>
> Hope this helps...
>
> Daniel
>
>
> Mike Baroukh a écrit :
>> Hi.
>>
>> Hi have an absolute layout with pictures.
>> Only 2 pictures are show simultaneously. Others are on the layout,
>> but out of view.
>>
>> I wan't on user click to show others picture.
>> For this, I do an animation to translate the layer.
>>
>> For translation from right to left, it works correctly : an other
>> picture come from right progressively while another exit on left side.
>>
>> But, for translation from left to right, it don't work : the right
>> picture exits correctly on right side, but left picture only appear
>> on left side at the end of the animation.
>> while translating, an empty space appear on left until the end of
>> translation.
>>
>> For translating, I make my own animation (not taken from XML because
>> it depends on image size) :
>>
>> scrollLeft = new TranslateAnimation(0, -(pictoWidth+hspace),
>> 0, 0);
>> scrollLeft.setDuration(300);
>> scrollLeft.setAnimationListener(this);
>> scrollRight = new TranslateAnimation(0, (pictoWidth+hspace),
>> 0, 0);
>> scrollRight.setDuration(300);
>> scrollRight.setAnimationListener(this);
>>
>> then, for translating, I do :
>> layout.startAnimation(scrollRight);
>>
>> (I join the widget source in case somebody is interesting on doing
>> the same thing ...)
>>
>>
>> Does somebody have any idea how tohave the same effect on left to
>> right scroll than right to left ?
>>
>> Thanks in advance.
>>
>> Mike
>>
>> PS: I can't use filpper because I have to picture visible at the same
>> time and only one disappear at a time.
>> It ould be possible but more complicated I thing ...
>>
>>
>>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---