Thanks Jeff! It worked but by overriding the onDraw call not the
dispatchDraw.

@Override
onDraw(Canvas canvas) {
                canvas.save();
                canvas.rotate(45);
                super.onDraw(canvas);
                canvas.restore();
        }

I tried the same method on an ImageView extended class but I didn't
get the same rotation, nothing happend than... any ideas?
canvas contains all that the user can see right?  So if it was a
LinearLayout the canvas will be what ever is contained inside it?
Sorry I 'm very new to graphics :P

Thanks!
-Jona

On Aug 2, 5:35 pm, Jeff Sharkey <[email protected]> wrote:
> Don't restore the Canvas until /after/ you super.dispatchDraw().
>
> j
>
>
>
> On Sun, Aug 2, 2009 at 10:32 AM, Moto<[email protected]> wrote:
>
> > 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 theTextViewwith 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 extendsTextView
> > {
> >        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);
> >        }
> > }
>
> --
> Jeff Sharkey
> [email protected]
--~--~---------~--~----~------------~-------~--~----~
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