Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7776509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:54:10+00:00 2026-06-01T17:54:10+00:00

I am attempting to chain two animations together, so when one completes, the other

  • 0

I am attempting to “chain” two animations together, so when one completes, the other begins. This is working except for one issue. After the first animation is complete, it moves back to it’s original position. I am setting fill after to true. What else am I missing?

Here is the code I am using. Note, this is in a class that is extending LinearLayout.

// FIRST ANIMATION
mAnimation = new TranslateAnimation(0, PANEL_END_X, 0, 0);
mAnimation.setDuration(PANEL_TRANSITION_TIME);
mAnimation.setFillAfter(true);

mAnimation.setAnimationListener(new Animation.AnimationListener() {
    public void onAnimationEnd(Animation animation) {

        // FIRST ANIMATION COMPLETE, CALL THE SECOND ANIMATION
        startAnimation(mAlphaAnimation);
    }
});

// SECOND ANIMATION     
mAlphaAnimation = new AlphaAnimation(1.0f, 0.0f);
mAlphaAnimation.setDuration(PANEL_ALPHA_TRANSITION_TIME);
mAlphaAnimation.setFillAfter(true);

Solution:

The only way I could get this to work to my satisfaction was to use an AnimationSet, but set the starting offset of the second animation to start offset + duration of the first animation, plus a little padding. They did not have to be completely exact in my case.

I tried playing with various values as CommonsWare suggested, but I would always get some type of “snapping” effect where the values would revert to their original value before taking the new one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:54:11+00:00Added an answer on June 1, 2026 at 5:54 pm

    After the first animation is complete, it moves back to it’s original position. I am setting fill after to true. What else am I missing?

    Animations are transient effects. If you want the effects to be permanent, you have to do that yourself in onAnimationEnd(). In the case of a TranslateAnimation, you need to change the LayoutParams or something of the affected widget to permanently keep it in its end position. Or, if you are translating it off the screen, set the visibility to View.GONE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use the data series from this example no longer passes the JSONLint
Attempting to use XStream's JavaBeanConverter and running into an issue. Most likely I'm missng
Attempting/struggling to get registration and sign-up working within an active admin project. I have
I'm hoping there's no performance or other disadvantage in attempting to avoid long chains
Attempting to run a MIB based SNMP script and I running into an issue.
Attempting to deserialize a stream to List<T> (or any other type) and am failing
I'm attempting to put together a generic method invoker (for a C++ OO/v8 bridge),
Attempting to follow this Java tutorial . About 63 pages in, you are instructed
I am attempting to manipulate a DOM tree using lxml 's etree module. One
I'm fairly new to this, and don't have anyone else to ask. I'm attempting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.