I'm struggling a bit to get this to work as expected with a dynamically created TextView (or any View other than the ImageView). For the 'move' detector, the TextView appears to be 'lagging' behind my finger. Two finger gestures cause the view to 'split' in two until I let go of one of the fingers.
Any help on figuring this out would be much appreciated. (I've also tried using Matrix transformations with the TextView by overriding OnDraw, but had little luck with that as well).
public boolean onTouch(View v, MotionEvent event)
{
mScaleDetector.onTouchEvent(event);
mRotateDetector.onTouchEvent(event);
mMoveDetector.onTouchEvent(event);
mShoveDetector.onTouchEvent(event);
float scaledViewCenterX = (_originalWidth * mScaleFactor)/2;
float scaledViewCenterY = (_originalHeight * mScaleFactor) /2;
// also attempted to translate with the difference to no avail
//float diffX = mFocusX - scaledViewCenterX;
//float diffY = mFocusY - scaledViewCenterY;
//v.setTranslationX(diffX*mScaleFactor);
//v.setTranslationY(diffY*mScaleFactor);
// Scale : Splits view in two. Jitters
v.setScaleX(mScaleFactor);
v.setScaleY(mScaleFactor);
// Translate : Lags behind finger. Jitters
v.setX(mFocusX);
v.setY(mFocusY);
// Set pivot joint
v.setPivotX(scaledViewCenterX);
v.setPivotY(scaledViewCenterY);
// Rotate : Splits view in two. Jitters
v.setRotation(mRotationDegrees);
}