View width does not change after scaling ObjectAnimator

Shouldn't the width be changed after I animate the scaleX property? I noticed that the click area decreases when I decrease the width of the views, so I assume that the width should be adapted. But when I call view.getWidth (), I still get the initial value.

        Log.d(TAG, "" + getWidth()); //Initial value
        setPivotX(getWidth() / 2);
        ObjectAnimator animator = ObjectAnimator.ofFloat(this, View.SCALE_X, 1.0f, 0.8f);
        animator.setInterpolator(new DecelerateInterpolator(1));
        animator.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
                Log.d(TAG, "" + getWidth()); //Initial value :(
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });
        animator.start();
+4
source share
2 answers

I don’t think that View animations alter these properties (size, border, or visibility). You have to do it yourself, at the end of the animation.

From this: http://developer.android.com/guide/topics/graphics/view-animation.html

. , , , , . , - . .

0

VPA, value-property-animator: fooobar.com/questions/1213678/...

0

All Articles