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

  • Home
  • SEARCH
  • 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 7848951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:22:51+00:00 2026-06-02T18:22:51+00:00

I am trying to animate a view which expands and shrinks back to the

  • 0

I am trying to animate a view which expands and shrinks back to the initial size. I tried using animation set to add two animations so that the second animation will start after the first animation but was not able to get it working.

AnimationSet expandAndShrink = new AnimationSet(true);
ScaleAnimation expand = new ScaleAnimation(
     1f, 1.5f, 
     1f, 1.5f,
     Animation.RELATIVE_TO_PARENT, 0,
     Animation.RELATIVE_TO_PARENT, 0);

ScaleAnimation shrink = new ScaleAnimation(
     1.5f, 1f, 
     1.5f, 1f,
     Animation.RELATIVE_TO_PARENT, 1f,
     Animation.RELATIVE_TO_PARENT, 1f);

expandAndShrink.addAnimation(expand);
expandAndShrink.addAnimation(shrink)
expandAndShrink.setFillAfter(true);
expandAndShrink.setDuration(1000);
expandAndShrink.setInterpolator(new AccelerateInterpolator(1.0f));

view.bringToFront();
view.startAnimation(expandAndShrink);

I really appreciate any help to get it working. Thanks in advance

  • 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-02T18:22:53+00:00Added an answer on June 2, 2026 at 6:22 pm

    I have fixed “expand” and “shrink” animations, and added durations for both. Also you should add shrink.setStartOffset(1000); so second animation starts later

        AnimationSet expandAndShrink = new AnimationSet(true);
        ScaleAnimation expand = new ScaleAnimation(
             1f, 1.5f, 
             1f, 1.5f,
             Animation.RELATIVE_TO_PARENT, 0,
             Animation.RELATIVE_TO_PARENT, 0);
        expand.setDuration(1000);
    
        ScaleAnimation shrink = new ScaleAnimation(
             1.5f, 1f, 
             1.5f, 1f,
             Animation.RELATIVE_TO_PARENT, 0f,
             Animation.RELATIVE_TO_PARENT, 0f);
        shrink.setStartOffset(1000);
        shrink.setDuration(1000);
    
        expandAndShrink.addAnimation(expand);
        expandAndShrink.addAnimation(shrink);
        expandAndShrink.setFillAfter(true);
        expandAndShrink.setInterpolator(new AccelerateInterpolator(1.0f));
    
        view.startAnimation(expandAndShrink);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im stuck trying to animate a table view smoothly which has an autolayout contraint.
I am currently trying to animation from one view to another using a swipe
I am trying to animate sliding out one view from a window and simultaneous
I am trying to animate the transform property of a view. Here is my
I am trying to animate the blinking between two images on an imageview to
I'm trying to animate an image which is partly hidden (via overflow: hidden) inside
I have a view which contains 2 image view that is using the ondraglistener
I am trying to animate in the MapView to a location by using Location
I am trying to animate an image using following code: [UIView beginAnimations:nil context:NULL]; [UIView
On a detail view I'm trying to pull the navigation item's title which is

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.