0

I using ObjectAnimator to move some views in my app, every thing works correctly but i can`t get view position using gettop,getleft functions, they always returns 0. My project min sdk is 14. I also tried also with getViewTreeObserver but still getting same results.

but = (Button) findViewById(R.id.but1);
    ObjectAnimator _animationStrategy = ObjectAnimator.ofFloat(but, View.TRANSLATION_X, 500);
    _animationStrategy.setDuration(5000);
    _animationStrategy.setInterpolator(new AccelerateDecelerateInterpolator());
    _animationStrategy.addUpdateListener(new AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Log.d("test","posX="+but.getLeft()+" posY="+but.getTop());
        }
    });
    _animationStrategy.start();
Anton Makov
  • 123
  • 3
  • 11

0 Answers0