Friday, December 24, 2010

[android-developers] Re: Help with animation

I think View1 is always going to have an intrinsic height of its
measured height for the layout. That is to say, an animation isn't
going to change a view's measured height over time, it will just
change the way it appears on screen over the duration of the
animation. The mere presence of View1 in your layout will cause the
layout to set aside its measured dimensions.

I could be wrong, but I don't think an animation with a layout like
this is going to achieve the effect you're looking for. You may have
to do something where you change the measured height of the view over
time and invalidate the view/layout at every tick to get it to re-
render everything.

Doug

On Dec 24, 6:18 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> I have a LinearLayout with 2 vertical components:
>
> View1
> View2
>
> I would like to smoothly animate-in View1.
>
> I am using the following animation:
>
> <scale android:fromXScale="1.0" android:toXScale="1.0"
> android:fromYScale="0.0" android:toYScale="1.0"
>            android:pivotX="0" android:pivotY="0"
> android:duration="@android:integer/config_longAnimTime"/>
>
> I am doing a:
>
> view1.startAnimation(animation);
> view1.setVisibility(View.VISIBLE);
>
> It works, but the problem is that View2 snaps down and View1 fills the
> gap.   How do I make it so View2 slide down smoothly?  I've tried
> postponing the setVisibilty() call to after the animation had
> finished, but then View1 slides down over View2 which looks even
> worse.
>
> Thanks.

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