Wednesday, June 8, 2011

[android-developers] Slide view up and down- choppy

I'm trying to slide a view on and off the bottom of the screen. The
view is a relative layout with a couple of child views- one a header
bar, and the other a listview, positioned below it with a margin in
all sides.

I'm using the translate animation code below. The performance is
terrible -- it is choppy and leaves traces until the animation is
completed. In addition, on sliding down, the header bar gets squeezed
in width to the width of the list view, and aligns with the top of it.

Is there a better way to do this? My hope is that the transition be
smooth and all child views remain fixed relative to the parent (and
themselves).


animation = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.0f, Animation.RELATIVE_TO_PARENT, 1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
animation.setDuration(1000);
animation.setFillEnabled(true);
animation.setFillBefore(true);
animation.setAnimationListener(new AnimationListener() {

set.addAnimation(animation);

LayoutAnimationController controller = new
LayoutAnimationController(set, 0.25f);
panel.setLayoutAnimation(controller);

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate