Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid set new size after scale animation
    primarykey
    data
    text
    <p>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! </p> <p>I found the solution for translate animation by setting its position parameters after animation end. Which moves the view to a new position permanently.</p> <p>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.</p> <pre><code>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.setDuration(600); // scaleAnim.setFillEnabled(true); scaleAnim.setFillAfter(true); view.setAnimation(scaleAnim); view.startAnimation(scaleAnim); 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 .getLayoutParams(); par.height = view.getMeasuredHeight() * 2; par.width = view.getMeasuredWidth() * 2; view.setLayoutParams(par); view.requestLayout(); } }); </code></pre> <p>p.s that setFillAfter(true) and setFillEnabled(true) are not the solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload