放大viewflipper图像
问题描述:
我有一个viewflipper包含3个图像。这些图像与onGestureListener相关联以进行滑动动作。我想对这些图像中的每一个实现放大和缩小效果,以正确读取图像上的文字。有一些出路吗?请帮助我举一些例子。由于放大viewflipper图像
答
这个问题已经问过,但你可以做这样的:
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);
}
});