Hello,
I got this code from another post and modified it to work for me as a
TextView.  I tried using the code below but no transformation is
happening?  Can someone help me out see what's wrong?  I trying to
draw the canvas of the TextView with the given Matrix transformation.

Thanks!
Moto!



import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;

public class CTextView extends TextView
{
        private Matrix mForward = new Matrix();
    private Matrix mReverse = new Matrix();
    private float[] mTemp = new float[2];

        public CTextView(Context context) {
                super(context);

                mForward.postRotate(90);
        mForward.invert(mReverse);
        }
        public CTextView(Context context, AttributeSet attrs) {
                super(context, attrs);

                mForward.postRotate(90);
        mForward.invert(mReverse);
        }
        public CTextView(Context context, AttributeSet attrs, int defStyle) {
                super(context, attrs, defStyle);

                mForward.postRotate(90);
        mForward.invert(mReverse);
        }

        @Override
        protected void dispatchDraw(Canvas canvas) {
                canvas.save();
                canvas.concat(mForward);
                canvas.restore();

                super.dispatchDraw(canvas);
        }

        @Override
        public boolean dispatchTouchEvent(MotionEvent event) {
                final float[] temp = mTemp;
        temp[0] = event.getX();
        temp[1] = event.getY();

        mReverse.mapPoints(temp);

        event.setLocation(temp[0], temp[1]);
        return super.dispatchTouchEvent(event);
        }
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to