开发者

swipe images in android

I need a little information about how to do a swipe image viewer for Android.Something exactly like this : http://www.photoswipe.com/latest/examples/jquery-mobile.html#&ui-state=dialog .I'm have a listView and I want every time i click an listview item it opens a new windows with the selected image in fullscreen and when I tab on the image,the bottom part with the left right button shows up and some informati开发者_JAVA技巧on above the image.In a fullscreen mode I want to be able to swipe left and right and different image shows up.

Any idea how to do this?Thanks a lot!


Insert imageviews inside a viewflipper (here is is called optionsVF)

In your onClick or something:

Animation in = AnimationFactory.inFromRight();
in.setDuration(500);
optionsVF.setInAnimation(in);
Animation   out = AnimationFactory.outToLeft();
out.setDuration(500);
optionsVF.setOutAnimation(out);
optionsVF.showNext();

my class :) AnimationFactory

/*
*  Copyright 2011 Sherif
*/

public class AnimationFactory {
    public static Animation inFromRight() {
    Animation inFromLeft = new TranslateAnimation(
    Animation.RELATIVE_TO_PARENT,  1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
    Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    );
    inFromLeft.setDuration(500);
    inFromLeft.setInterpolator(new AccelerateInterpolator());
    return inFromLeft;
    }

    public static Animation outToLeft() {
    Animation inFromLeft = new TranslateAnimation(
    Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,  -1.0f,
    Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    );
    inFromLeft.setDuration(500);
    inFromLeft.setInterpolator(new AccelerateInterpolator());
    return inFromLeft;
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜