Ich habe Pinch Zoom für eine TextView mit dem folgenden Code implementiert. Aber mit dem Code TextView zoomt auch wenn ein Benutzer irgendwo auf dem Bildschirm klemmt. Ich muss den Pinch-Zoom nur ausführen, wenn der TextView gequetscht wird. Kann mir jemand helfen?Wie erkennt man die Ansicht, die in Android gezoomt wird?
Meine vorhandenen Code:
@Override
public boolean onTouchEvent(MotionEvent event) {
// return super.onTouchEvent(event);
if (event.getPointerCount() == 2)
{
int action = event.getAction();
int pureaction = action & MotionEvent.ACTION_MASK;
if (pureaction == MotionEvent.ACTION_POINTER_DOWN)
{
mBaseDist = getDistance(event);
mBaseRatio = mRatio;
}
else
{
float delta = (getDistance(event) - mBaseDist)/STEP;
float multi = (float) Math.pow(2, delta);
mRatio = Math.min(1024.0f, Math.max(0.1f, mBaseRatio * multi));
mTextView.setTextSize(mRatio + 13);
}
}
return true;
}