Friday, July 30, 2010

[android-developers] Re: Subclassing Animation

Alright, invalidate seems to just call onDraw, which is exactly what
the docs say it does, so my approach is to call setMeasuredDimension
in the method called by the Runnable posted by the tick, (It seems
like onMeasure only gets called if the dimensions are changed by
setMeasuredDimension, so if you only set the dimensions in onMeasure,
nothing happens.) then call getParent().requestLayout(). (This means
setMeasuredDimension gets called twice.)

I want my View to overlap other views at certain times, so I'm
guessing that I'll have to mess around with the View's LayoutParams,
and adjust the margins as well.

On Jul 30, 11:56 am, Romain Guy <romain...@android.com> wrote:
> Something like that :) The way we usually do it is post a delayed
> invalidate instead of using a Timer. We'll have a better solution in a
> future release of Android though.
>
>
>
> On Fri, Jul 30, 2010 at 11:52 AM, jsera <gall.blad...@gmail.com> wrote:
> > Thanks for the quick reply!
>
> > So then would the best approach be to call invalidate, and change the
> > size of the View using setMeasuredDimension on every tick of a Timer
> > object?
>
> > On Jul 30, 11:39 am, Romain Guy <romain...@android.com> wrote:
> >> Subclassing Animation won't help you unfortunately. It would be best
> >> for you to implement the animation yourself.
>
> >> On Fri, Jul 30, 2010 at 11:18 AM, jsera <gall.blad...@gmail.com> wrote:
> >> > Hi, I'd like to subclass Animation in order to get an animation that
> >> > changes the clipRect of the canvas passed to a particular custom view
> >> > instead of messing with the matrix of that canvas.
>
> >> > The reason for this, is that I want to animate a partially obscured
> >> > bitmap up to display it fully.
>
> >> > So, say I have a bitmap 100x100 px, and at the start of the animation,
> >> > I want to start out displaying the top 100x50px of it, so the clipRect
> >> > will be of the size 100x50.
>
> >> > I want to move the clipRect 50px up, and add 50 px to it's size, but
> >> > it looks like both the scale and translate animations just change the
> >> > matrix, so I wind up displaying the same 100x50px area, but stretched
> >> > to fit in in whatever space.
>
> >> > Anyway, what's the best way of accomplishing this?
>
> >> > --
> >> > 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+unsubscribe@googlegroups.com
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/android-developers?hl=en
>
> >> --
> >> 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
>
> > --
> > 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+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> 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

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment