android set new size after scale animation

android scale animation from bottom to top
android scale animation from center
android scale animation not working
scale animation android
android resize animation
scale animation android xml
android animation duration
android objectanimator scale

I am using Translate and scale animation. First i translate my Frame Layout to the center of the screen and i set its position parameters using layout parameters to the center of the screen. That works fine! On translate animation end i run the scale animation, my layout scales 2 times its original size. Actually my frame Layout (which I'm animating) consists of buttons and image views. As in android the animation doesn't transforms the view it only changes the position to which it must be drawn. Now my problem is that i cannot get my buttons to work. Because they are not actually there!

I found the solution for translate animation by setting its position parameters after animation end. Which moves the view to a new position permanently.

However in case of scale animation i have to change the SIZE of the Layout along with the child within. But it is not working as i am multiplying the original height width with the scaling factor. here is my code for the scale animation.

ScaleAnimation scaleAnim = new ScaleAnimation(1.0f, 2.0f, 1.0f,
                    2.0f, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);

            // scaleAnim.setFillEnabled(true);


            scaleAnim.setAnimationListener(new AnimationListener() {

                public void onAnimationStart(Animation animation) {


                public void onAnimationRepeat(Animation animation) {


                public void onAnimationEnd(Animation animation) {
                    FrameLayout.LayoutParams par = (FrameLayout.LayoutParams) view

                    par.height = view.getMeasuredHeight() * 2;
                    par.width = view.getMeasuredWidth() * 2;



p.s that setFillAfter(true) and setFillEnabled(true) are not the solution.

I would comment above but I don't have enough rep. This page from the documentation explains the difference between the view animation system and the property animation system. From this you can make ObjectAnimator and AnimatorSet objects which will move the buttons and edit the actual view, not just the drawing of the view.

The property animation system allow streamlined animation of View objects and offers a few advantages over the view animation system. The view animation system transformed View objects by changing the way that they were drawn. This was handled in the container of each View, because the View itself had no properties to manipulate. This resulted in the View being animated, but caused no change in the View object itself. This led to behavior such as an object still existing in its original location, even though it was drawn on a different location on the screen. In Android 3.0, new properties and the corresponding getter and setter methods were added to eliminate this drawback.

The property animation system can animate Views on the screen by changing the actual properties in the View objects. In addition, Views also automatically call the invalidate() method to refresh the screen whenever its properties are changed.

ScaleAnimation, However in case of scale animation i have to change the SIZE of the Layout along with the child within. But it is not working as i am multiplying the original height  This example demonstrate about Android image scale animation relative to center point. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml.

PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.SCALE_X, 1, 1.2f);
PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, 1.2f);
ObjectAnimator scaleAnimation = ObjectAnimator.ofPropertyValuesHolder(your_view, pvhX, pvhY);

AnimatorSet setAnimation = new AnimatorSet();;

Move a View with Animation, android:fillAfter, When set to true, the animation transformation is applied after the Constructor used when a ScaleAnimation is loaded from a resource. Initialize this animation with the dimensions of the object being animated as well as interpolatedTime, float : The value of the normalized time (0.0 to 1.0) after it has  After this, the Developer Options section will appear in the Settings. Now, that everything’s set. You’re ready to play with animations. Here’s how to do that: Head over to Developer Options. Scroll down until you find Window Animation Scale, Transition Animation Scale, and Animator Duration Scale.

Solution which worked for me,

  1. No need of setting setFillAfter as we are setting the view's scale and translation ourself, even if u set it no issue should occur.


  2. Use scaleX and scaleY call's to set the scale of view after animation end's

                public void onAnimationEnd(Animation animation) {

    it will position the scaled view accordingly.

Android, Move a View with Animation. Contents; Change the view position with ObjectAnimator; Add curved motion. Use PathInterpolator; Define your  settings put global transition_animation_scale 0.75 settings put global animator_duration_scale 0.75 To set a speed besides 0.75x, just replace 0.75 with any value less than or equal to 1.

Using ObjectAnimator and AnimatorSet solved the issue.

Android: ScaleAnimation и <scale>, However, the view APIs like getWidth() and getHeight() would still return the old unchanged values. So how exactly is the view shown after scale and how does it​  Scale Animation – Introduction. Scale Animation is basically to increase or decrease the size of the View. There is a class ScaleAnimation. We need to create instance of ScaleAnimation (Can be done in XML also) to do the work. One of the main constructor of this class is: public ScaleAnimation(float fromX, float toX, float fromY, float toY,

Android image scale animation relative to center point?, Тег scale и соответствующий ему класс ScaleAnimation служат для анимации размеров объекта. <set xmlns:android="​android" AnimationListener animationEnlargeListener = new Animation. changeTransform - Animates the changes in scale and rotation of target views. changeImageTransform - Animates changes in size and scale of target images. When you enable activity transitions in your app, the default cross-fading transition is activated between the entering and exiting activities.

Android Programming Unleashed, This example demonstrate about Android image scale animation relative to center point.Step 1 − Create a new project in Android Studio, go to  android:layout_width="wrap_content" android:layout_height="18dp" android:scaleType="fitXY" Let’s have a look at what fitXY does. In theory this doesn’t look really bad, we are going to have our fixed height and then it’s going to scale our image filling the width.

Defining animation scale, To scale Views, we need to set values for the attributes described in Table 9.9. Table 9.9. Attributes Used in Scale Animation The following XML snippet applies a After the View is scaled, it starts shrinking and scales down to its original size​  The PathInterpolator class is a new interpolator introduced in Android 5.0 (API 21). It is based on a Bézier curve or a Path object. This interpolator specifies a motion curve in a 1x1 square, with anchor points at (0,0) and (1,1) and control points as specified using the constructor arguments.

  • You could do this by putting everything where you want it to be when the animation ends, and then animate it to that position. Making sure to hide it before the animation starts and disabling buttons until the animations have ended.
  • the problem is by scale animation the original height and width doesn't change after scaling. So my buttons aren't working
  • Not even if you create them full size and then scale them from say 10% to the original size? I've done something similar with a translate and scale animation. And I was able to click the buttons when the animation completed. I'll try to dig up that piece of code for you.
  • The solution would be very appreciated man. Actually it is like a dialog box. i move it to center set is to center using layout para margin. then scale it up twice the original size. But my button remains somewhere else not where it is shown.