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


On Apr 18, 12:18 pm, "daniel.benedykt" <[email protected]>
wrote:
> Hi Mike,
>
> I am having the same issue here. I try a lot of things and nothing
> worked.
> Does anyone have the answer to this?
>
> Thanks
>
> Daniel
>
> On Apr 16, 11:34 pm, Mike Baroukh <[email protected]> wrote:
>
> > 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 ...
>
> >  MbaFlipper.java
> > 3KViewDownload
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to