放大viewflipper图片 [英] zoom in viewflipper images

查看:186
本文介绍了放大viewflipper图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3图像viewflipper。对于刷卡action.I要实现放大和缩小影响每个这些图像,对于正确读取影像上的著作,这些图像与onGestureListener有关。有一些办法呢?请帮我用一些例子。谢谢

I have a viewflipper that contain 3 images. these images are associated with onGestureListener for swipe action.I want to implement zoom in and zoom out effect on each of these images, for properly reading the writings on images. Is there some way out? Please help me with some example. Thanks

推荐答案

这个问题已经被问过,但你可以做到这样的:

The question was already asked, but you can do it like this :

iv = (ImageView) findViewById(R.id.imageview);
zc = (ZoomControls) findViewById(R.id.zoom_controls);
zc.setOnZoomInClickListener(new OnClickListener() {
    public void onClick(View v) {
        float oldZoom = currentZoom;
        currentZoom = currentZoom * 1.25;
        zc.setIsZoomOutEnabled(true);
        if (3.0 < currentZoom) {
            zc.setIsZoomInEnabled(false);
        }
        scaleAnim = new ScaleAnimation(oldZoom, currentZoom, oldZoom, currentZoom, 0, 0);
        scaleAnim.setFillAfter(true);
        iv.startAnimation(scaleAnim);
    }
});
zc.setOnZoomOutClickListener(new OnClickListener() {
    public void onClick(View v) {
        float oldZoom = currentZoom;
        currentZoom = currentZoom / 1.25;
        zc.setIsZoomInEnabled(true);
        if (0.33 > currentZoom) {
            zc.setIsZoomOutEnabled(false);
        }
        scaleAnim = new ScaleAnimation(oldZoom, currentZoom, oldZoom, currentZoom, 0, 0);
        scaleAnim.setFillAfter(true);
        iv.startAnimation(scaleAnim);
    }
});

来源:在viewflipper 放大图片

这篇关于放大viewflipper图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆