I reckon I know how to do it. :o)

You can get Tween animations in an AppWidget by using the
LayoutAnimation tag in your widget's layout xml, it supports all the
standard Tween animations including Alpha fades.

The first problem is that the animation only runs when you first add
the Widget to the Home screen, and that RemoteViews xml is first sent.
Subsequent updates using the same XML wont trigger the animation.
However, you can have an identical XML file with a different name, and
then just swap between them when you are updating your remote views.
So every time you update, you get your tween animation.

Now, to actually get the effect.  I dont have 2.2, but I assume it is
similar to the effect at the top of the Market app itself, where a
promoted app picture fades into the next one?

If so then I would have 2 image views. Set the first one to the show a
picture A. On top of that (higher in the z order) have your other
Image view surrounded with the alpha LayoutAnimation so that it fades
IN, and showing a picture B.

So when the update occurs you will initially see the original picture
A, and then the new picture B fades in on top of that one so that A is
hidden.

Then the next time you update, set the first image view to show
picture B, and set the animated image view to now show C, etc.

It should work... if you can't get it working let me know, I have done
similar things before.


For what it is worth this another reason we could do with proper
animations in AppWidgets, it seems a common request, and now we have
the precedent of Google's own Market widget using it. I would be
interested to know if this is something new in 2.2, or they have done
the hacky animation implementation described above?

I added a feature request to support animations and other common
requests for AppWidget functionality, please anyone feel free to Star
it:

http://code.google.com/p/android/issues/detail?id=9580&sort=-id&colspec=ID
Type Status Owner Summary Stars&start=100


Regards
James






On Jul 10, 1:53 am, Matt <[email protected]> wrote:
> > Are you talking about an actual AppWidget that sits on the users home
> > screen? I was not aware there was  awidgetfor the market.
>
> Yes, it is a part of the Froyo update.  It's an actual
> AppWidgetProvider.
>
> > I think it is new for 2.2. After seeing this thread, I found it on my
> > N1. It does what looks like an AlphaAnimation to transition between
> > apps it is promoting. Unless it is actually part of the N1's home
> > screen, I have no idea how they're pulling off that effect.
>
> I am seeing it on a myTouch with Froyo.  So it seems it is a part of
> the 2.2 release.
>
> I will look into the AlphaAnimation.  I'm just not sure how it is done
> with RemoteViews.  What I suspect is that it is something new to the
> 2.2 SDK, which is unfortunate because we can't lock ourwidgetto 2.2
> and above.
>
> I would still like to hear any other ideas people may have, though! :)
>
> -Matt

-- 
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