3
Personal my problem is the second. I need to enlarge a ImageView
with that movement of forceps well known, but I’m already in the third day researching on the internet how to do and banging the head, But the most I could get was a tutorial code that just magnifies the image by not allowing the movement of the enlarged image it only magnifies at a fixed point and stays. I will be putting the code and I would like to know how to implement the image movement or if anyone can help, put a code right, because as I said I hit my head too much and nothing came out here rsrs. Hugs.
public class tela87 extends SherlockFragmentActivity {
private ImageView img;
private Matrix matrix = new Matrix();
private float scale = 1f;
private ScaleGestureDetector SGD;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tela835gavetti);
img = (ImageView)findViewById(R.id.imageView1);
SGD = new ScaleGestureDetector(this,new ScaleListener());
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
SGD.onTouchEvent(ev);
return true;
}
private class ScaleListener extends ScaleGestureDetector.
SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
scale *= detector.getScaleFactor();
scale = Math.max(0.1f, Math.min(scale, 5.0f));
matrix.setScale(scale, scale);
img.setImageMatrix(matrix);
return true;
}
}
}