Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Move View after animation?

I'm trying to basically have a button move down to the bottom of the screen with an animation after it is clicked.

I have the animation working perfectly, but the button doesn't stay at the bottom of the screen after the animation finishes. I've tried using offsetTopAndBottom(), but it only stays down there for one frame, and is redrawn at the top. How can I get the button to stay?

like image 945
Kleptine Avatar asked Jan 17 '10 02:01

Kleptine


People also ask

How do I change an animation layout?

All you need to do is set an attribute in the layout to tell the Android system to animate these layout changes, and system-default animations are carried out for you. Tip: If you want to supply custom layout animations, create a LayoutTransition object and supply it to the layout with the setLayoutTransition() method.

How do you animate a view?

Create ImageView in the activity_main. xml along with buttons that will add animation to the view. Navigate to the app > res > layout > activity_main. xml.


2 Answers

Did you try to call setFillAfter(true) on your animation instance?

Regards!

like image 53
Ramps Avatar answered Oct 06 '22 00:10

Ramps


Yes, setFillAfter(true) works.

But the strange thing is that corresponding android:fillAfter XML attribute does not provide same effect. Be aware, guys.

like image 41
Mix Avatar answered Oct 06 '22 01:10

Mix