Ah yes, that's what I was missing.  :)

j

On Mon, Jul 27, 2009 at 8:22 AM, Romain Guy<romain...@google.com> wrote:
>
> Your solution might not always work because you do not save/restore
> the Canvas in dispatchDraw().
>
> On Mon, Jul 27, 2009 at 2:46 AM, Jeff Sharkey<jshar...@android.com> wrote:
>>
>> It's actually really easy, and you don't need to use animations.  I
>> did something like this recently by using a wrapper layout that
>> adjusts the Canvas and any MotionEvents.  (You could also use this
>> approach rotate the entire layout to any arbitrary angle.)
>>
>> I think romainguy told me to use Canvas.concat(mForward) instead of
>> setMatrix(), but I haven't updated the code in awhile.
>>
>>
>>
>> private static class FlipLayout extends FrameLayout {
>>    private Matrix mForward = new Matrix();
>>    private Matrix mReverse = new Matrix();
>>    private float[] mTemp = new float[2];
>>
>>    public FlipLayout(Context context) {
>>        super(context);
>>
>>        mForward.postRotate(180);
>>        mForward.invert(mReverse);
>>    }
>>
>>   �...@override
>>    protected void dispatchDraw(Canvas canvas) {
>>        canvas.setMatrix(mForward);
>>        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);
>>    }
>> }
>>
>>
>>
>>
>> On Fri, Jul 24, 2009 at 10:53 PM, Josh Hoffman<keshis...@gmail.com> wrote:
>>>
>>> I posted earlier today on this topic, but I'm re-posting as I haven't
>>> been able to locate my post via search. I apologize if this is indeed
>>> a double-post, but it seems something went wrong with the original.
>>>
>>> I've been trying to find a means of rotating a view such that it is
>>> flipped upside-down and stays that way. I found the Rotation Animation
>>> method, but I have been unable to find a means of keeping the view
>>> rotated. Repeating the animation doesn't suit my purposes, and in fact
>>> I don't want an animation at all if possible. What I would like is
>>> something akin to a transformation, except to be used on a TextView or
>>> a LinearLayout.
>>>
>>> I have considering overriding methods to accomplish this task by
>>> slightly modifying the animation code, but I'm not sure how extensive
>>> the work for this would be. Additionally, I'm not sure where to find
>>> the source for those methods.
>>>
>>> If anyone could recommend a means of accomplishing this task, whether
>>> it be by an override or perhaps something simple that I am missing, I
>>> would appreciate it very much. Thanks!
>>>
>>> >
>>>
>>
>>
>>
>> --
>> Jeff Sharkey
>> jshar...@android.com
>>
>> >
>>
>
>
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
>
> >
>



-- 
Jeff Sharkey
jshar...@android.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to