上枪王平滑图像放大 [英] Smooth image zoom on Double Tap
本文介绍了上枪王平滑图像放大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有我想要顺利放大上双击一个ImageView的。
I have an ImageView which I want to smoothly zoom on double tap.
目前我有变焦这样的工作
Currently I have zoom working like this
public boolean onDoubleTap(MotionEvent e) {
ImageView imageView = (ImageView) findViewById(imageViewId);
int width = imageView.getWidth();
int height = imageView.getWidth();
float maxScale;
if ( width < height ) {
maxScale = (float) (width * Math.pow(1.5, 6));
} else {
maxScale = (float) (height * Math.pow(1.5, 6));
}
Drawable d = imageView.getDrawable();
int imageWidth = d.getIntrinsicWidth();
int imageHeight = d.getIntrinsicHeight();
float[] value = new float[9];
matrix.getValues(value);
scaleWidth = (int)(imageWidth * value[Matrix.MSCALE_X]);
scaleHeight = (int)(imageHeight * value[Matrix.MSCALE_Y]);
if ( (scaleWidth * 2) < maxScale ) {
matrix.postScale(2, 2, e.getRawX(), e.getRawY());
} else {
matrix.postScale(0, 0, e.getRawX(), e.getRawY());
}
isDoubleTab = true;
tuneMatrix(matrix);
savedMatrix.set(matrix);
return false;
}
这不是光滑的。我用Google搜索了很多,但无法找到DoubleTap任何工作方案。任何想法?
It's not smooth at all. I googled a lot, but wasn't able to find any working solution for DoubleTap. Any ideas?
推荐答案
下面是imageZoom上双击一个很好的链接... http://blog.sephiroth.it/2011/04/ 04 / ImageView的变焦和滚动/
Here is a good link for imageZoom on double tap... http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
这篇关于上枪王平滑图像放大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文