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 4236392
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:37:58+00:00 2026-05-21T02:37:58+00:00

I’m trying out the new LayoutTransition class in Honeycomb. I have set an animation

  • 0

I’m trying out the new LayoutTransition class in Honeycomb. I have set an animation that slides a View into place when adding it to a ViewGroup. I noticed that there is a slight delay (around 20ms) between when a view first renders and when the LayoutTransition.APPEARING animation begins. In other words, after the view appears on screen, it hangs in the air for a moment, and then starts to animate into place. You can notice this even in the ApiDemos sample project. In the layout animation examples, there’s always a delay before a ViewGroup‘s APPEARING animation starts. I’ve even tried setting the other LayoutTransition animations to null, or finally giving them very short durations, but still the APPEARING animation is delayed. Here’s my code:

public class DebugExampleFour extends Activity {
    private int numButtons = 1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.debug_example_four);

        final ViewGroup frame = (ViewGroup) findViewById(R.id.frame_container);
        LayoutTransition transitioner = new LayoutTransition();

        Animator appearingAnimation = ObjectAnimator.ofFloat(null, "translationX", 600, 0);
        appearingAnimation.setDuration(45);
        appearingAnimation.setStartDelay(0);
        appearingAnimation.setInterpolator(new DecelerateInterpolator());
        appearingAnimation.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator anim) {
                View view = (View) ((ObjectAnimator) anim).getTarget();
                view.setTranslationX(0f);
            }
        });
        transitioner.setAnimator(LayoutTransition.APPEARING, appearingAnimation);
        Animator dummyAnimation = ObjectAnimator.ofInt(0, 1);
        dummyAnimation.setDuration(1);
        dummyAnimation.setStartDelay(0);
        transitioner.setAnimator(LayoutTransition.CHANGE_APPEARING, dummyAnimation);
        transitioner.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, dummyAnimation);
        transitioner.setAnimator(LayoutTransition.DISAPPEARING, dummyAnimation);

        frame.setLayoutTransition(transitioner);

        Button addButton = (Button) findViewById(R.id.addNewButton);
        addButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Button newButton = new Button(DebugExampleFour.this);
                newButton.setText("Click To Remove " + (numButtons++));
                newButton.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        frame.removeView(v);
                    }
                });
                frame.addView(newButton, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

            }
        });    
    }

}

Here’s the layout file that goes along with the example:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:orientation="vertical">
    <Button android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:text="Add Button"
        android:id="@+id/addNewButton" />
    <LinearLayout android:orientation="vertical"
        android:layout_width="match_parent" android:layout_height="match_parent"
        android:id="@+id/frame_container" android:animateLayoutChanges="true" />
</LinearLayout>

How do I eliminate the delay before the APPEARING animation?

  • 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-05-21T02:37:58+00:00Added an answer on May 21, 2026 at 2:37 am

    Right – there’s a delay at both levels. When you’re running an Animator in the context of a LayoutTransition, you want to set the duration and startDelay on the LayoutTransition object, not on the underlying Animator (because the transition object will supply its own values for these properties to the animators that it runs).

    The reason for this is that a LayoutTransition is generally going to be a sequence of animations that run on the objects inside a container. So, for example, if you want an object to ‘appear’ in a container, then the transition will first animate the other objects out of the way, then animate the new object into place. Imagine adding an item into the middle of a set of objects (as in the case you see in the ApiDemos apps); it first makes space, then fades the object in.

    In the case of the original code above, you want the appearing animation to run immediately, so you should set the transition startDelay for APPEARING to 0 (as you did in the answer above).

    Going the other way, DISAPPEARING animations by default have no startDelay, but CHANGE_DISAPPEARING animations have a startDelay equal to the duration of the DISAPPEARING animation, under the assumption that you first want to remove an item, then animate the other items in the container into their new places.

    Since these are assumptions that don’t necessarily apply to every situation, there are duration/startDelay properties on LayoutTransition to control the behaviors according to how you need it to work in your specific cases.

    Note also that if you don’t want to run one of the animation types, you should set that animation to null (see the documentation for LayoutTransition.setAnimator(int, Animator)). Setting it to your dummyAnimator will not have the same effect. For one thing, the default duration/startDelay values on the LayoutTransition will still apply, even if you supply custom Animators for these animations.

    Something else to be aware of: the underlying timing mechanism (for Android, but also for most other platforms I’ve ever worked on) is going to have some minimum resolution. So you you set a duration of ‘1’, that may not result in that animation ending in 1ms. Instead, it will run for one frame, then on the next frame (generally the refresh rate of the device in a well-behaved application if the system is not bogged down) it will see that the animation should end.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.