Resize an animated Android button on both sides

Android animation How to resize buttons on both sides (left and right) at the same time How is this image

Sample image

I tried this, but it does not work the way I want

public void scaleView(View v, float startScale, float endScale) {
    Animation anim = new ScaleAnimation(
            startScale, endScale, // Start and end values for the X axis scaling
            1f, 1f, // Start and end values for the Y axis scaling
            Animation.RELATIVE_TO_SELF, 0f, // Pivot point of X scaling
            Animation.RELATIVE_TO_SELF, 1f); // Pivot point of Y scaling
    anim.setFillAfter(true); // Needed to keep the result of the animation
    anim.setDuration(3000);
    v.startAnimation(anim);
}
+4
source share
1 answer

Have you tried this:

v.animate().setDuration(3000).scaleX(endScale);
0
source

Source: https://habr.com/ru/post/1679835/


All Articles