简体   繁体   English

Android:当动画在画廊中停止时,如何将低质量图像更改为高质量图像?

[英]Android: how to change a low quality image to the hi quality one when the animation stops in gallery?

I want to do an image gallery like in iphone. 我想像iPhone一样做一个图像库。 I want to show low quality (pre-resized) images and when the image is active I want to process the big image and show the result in the gallery. 我想显示低质量(预调整大小)的图像,当图像处于活动状态时,我想处理大图像并在图库中显示结果。

I have two questions. 我有两个问题。 How to attach a listener on the animation stop in gallery? 如何在画廊中的动画停止上附加监听器? And how to access an image after this action? 以及如何在此操作后访问图像?

You can set an AnimationListener on your animation, and override the onAnimationEnd method. 您可以在动画上设置AnimationListener,并覆盖onAnimationEnd方法。

From http://www.roosmaa.net/animation-ended-callback/ : 来自http://www.roosmaa.net/animation-ended-callback/

ImageView viewN = ..;
Animation animN = ...;
Drawable myNewDrawable = ...;
animN.setAnimationListener(new AnimationListener() {
    // ...
    void onAnimationEnd(Animation anim)
    {
        //Do your work here.
        viewN.setDrawable(myNewDrawable);
        return;
    }
    // ...
});
viewN.startAnimation(animN);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM