Hey folks,

I'm doing Android since 3 weeks and I really like it, everything was
fine but now I really need help.

I do a simple slideshow app, I got my pictures in an array (not really
array but that doesn't matter now), and I'd like to use transition
effect to slide in the next picture.

OK, so I have /res/picture.xml like this (I explain later why I set
the width to 320px):

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_height="fill_parent" android:layout_width="320px"
android:gravity="center_horizontal">
        <ImageView
                android:id="@+id/picture"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
        />
</AbsoluteLayout>


...and my class has these lines:

setContentView(R.layout.picture);
ImageView pictureImageView = (ImageView) findViewById(R.id.picture);
Animation frameAnimation = AnimationUtils.makeInAnimation(this,
false);
frameAnimation.setDuration(500);
frameAnimation.setAnimationListener(animation);
pictureImageView.setImageResource(pictureResource.getPicture());
pictureImageView.startAnimation(frameAnimation);


Don't worry about pictureResource.getPicture(), this retrieves a valid
image resource.
Also, the variable 'animation' is an object for a proper
AnimationListener.
This class which implements AnimationListener sets the background of
the current window to the current picture by onAnimationEnd()

Now, the way it works:
if you use your device in vertical direction, the application steps
forward in the gallery (pictureResource.getPicture() gives the next
picture resource), and you can see the actual picture because it's in
the background, and the new picture slides in nicely.
However, if the device is in horizontal direction, the background got
stretched to the whole screen, which is bad for me, as all my pics are
portrait images. That's why I set the layout width to 320px, but that
doesn't help, the same effect as I used fill_parent

You can ask, why I don't use layers.

I tried, 2 ImageViews under each other and the bottom ImageView is
changed to store the current picture, while the top ImageView has the
new image (the one slides in), but in this way the slide-animation was
"under" all the ImageViews. In vertical direction, I could only see
the pictures changing without transition. I've seen the why in
horizontal direction: 'cause the animation is "under" the ImageViews
(both), the animation effect ended at the edge of the ImageView
container. After it slide in, the new image got shown, which is
alright, but ain't what I want. I wanna see the old image while the
new image slides in ABOVE the old image.
I used frameAnimation.setZAdjustment(Animation.ZORDER_TOP) but the
animation was still under the ImageViews.

Hope you understand my problem, and help me if you can

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to