Code example for RelativeLayout

Methods: getHeight, getWidth

0
                } else if (curve == SIN_ID) {
                    d = Math.sin(x * 2. * Math.PI) / 4. + x;
                } 
                return (int) (d * delta);
            } 
        }, button.getLeft(), (top_layout.getWidth() - button.getWidth() - button.getLeft()));
        animator_left.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
 
            @Override 
            public void onAnimationUpdate(ValueAnimator animation) {
                button.setTranslationX((Integer) animation.getAnimatedValue());
 
            } 
        }); 
        animator_left.setDuration(duration);
        //if (courbe == CIRCLE_ID)  animator_left.setRepeatCount(ValueAnimator.INFINITE); 
 
        ValueAnimator animator_top = ValueAnimator.ofObject(new TypeEvaluator<Integer>() {
            @Override 
            public Integer evaluate(float x, Integer start_value, Integer end_value) {
 
                int delta = (end_value - start_value);
                double d = x;
                if (curve == EXP_ID) {
                    d = (Math.exp(x) - 1.) / (Math.exp(1) - 1.);
                } 
                return (int) (d * delta);
            } 
        }, button.getTop(), (top_layout.getHeight() - button.getHeight() - button.getTop()));
        animator_top.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
 
            @Override 
            public void onAnimationUpdate(ValueAnimator animation) {
                button.setTranslationY((Integer) animation.getAnimatedValue());