如何实现在android的图像视图缩放效果? [英] How to implement zoom effect for image view in android?

查看:412
本文介绍了如何实现在android的图像视图缩放效果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现的图像缩放,我已经试过有这么多的codes.But我没有得到的手势事件完全的想法。我想,当我们运用双击来实现,图像将放大根据触摸的地方(事件x和y)。我只需要实现缩放此时没有pan.Can任何机构给我建议?

I have to implement image zooming, I have tried with so many codes.But i didnt get full idea of gesture events. I want to implement when we apply double tap, image will be zooming according to the touch place(event x and y).I have to implement only zooming at this time no pan.Can any body suggest me ?

编辑:     其实我已经实现了与图像viewflipper,如果我尝试应用平移和缩放效果,有时图像将被改变。我要落实在用户点击的变焦效果。

Actually i have implemented that viewflipper with images, if i try to apply pan and zoom effect, sometimes images will be changed.I want to implement zoom effect for where the user is clicked.

给我的一些想法......

Give me some idea of that....

推荐答案

懒惰的人可以使用这个LIB ,只是内部导入项目

Lazy man can use this lib, Just import inside your project and

ImageView mImageView;
PhotoViewAttacher mAttacher;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Any implementation of ImageView can be used!
    mImageView = (ImageView) findViewById(R.id.iv_photo);

    // Set the Drawable displayed
    Drawable bitmap = getResources().getDrawable(R.drawable.wallpaper);
    mImageView.setImageDrawable(bitmap);

    // Attach a PhotoViewAttacher, which takes care of all of the zooming functionality.
    mAttacher = new PhotoViewAttacher(mImageView);
}


// If you later call mImageView.setImageDrawable/setImageBitmap/setImageResource/etc then you just need to call
attacher.update();

这篇关于如何实现在android的图像视图缩放效果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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