How to scale View / ViewGroup - adjust animation properly?

In a few words, I want to scale the view - in the same way as the Android Market does when you click the "Advanced" button, for example, "Description".
I understand that the Android Market has the structure of the following structure:

<FrameLayout android:id="@+id/artists_frame" android:layout_width="fill_parent" android:layout_height="64dip" android:layout_below="@id/something1" android:layout_above="@id/something2" > <!-- Some view there, which height >> 64dip --> </FrameLayout> 

So, I tried various animations / LayoutAnimations in FrameLayout (via view.setAnimation(), view.setLayoutAnimation() and ScaleAnimation ), but the effect is always the same: the view is animated, but the actual layout_height after scaling remains the same (so the position of the others views dependent on this FrameLayout remains unchanged).

After that, I thought: I am changing in the layout_height loop of this FrameLayout:

 layoutParams = view.getLayoutParams() layoutParams.height = scaleTo; layout.setLayoutParams(layoutParams); 

I have an animated, market view, but cost (performance !!!) is a way ...

So, the question arises: is there any other correct way to scale (for example, a height from 50dip to 200dip) of this View / ViewGroup in order to change the position of the views under the animation view?

+7
source share
1 answer

As Chet Haase says in this blog post: http://android-developers.blogspot.com/2011/02/animation-in-honeycomb.html

"... Finally, previous animations changed the appearance of the targets ... but they actually didn't change the objects themselves ..."

Since your need is only visual, instead of changing the LayoutParameters I would animate the view below, as well as using translation using android:fillAfter for both.

+1
source

All Articles