androidviewanimator

Android - add a view to ViewAnimator at the beginning


I need to add a view in the beginning of the views at ViewAnimator. How can I do that? ViewAnimator.addView(view) adds view to the end of the list. But I need it to be added at the beginning. Thanks!


Solution

  • ViewAnimator has an additional method for adding view. You can add the view at index 0.

    addView(View child, int index, ViewGroup.LayoutParams params)
    Adds a child view with the specified layout parameters.