Example usage for android.widget LinearLayout getTranslationY

List of usage examples for android.widget LinearLayout getTranslationY

Introduction

In this page you can find the example usage for android.widget LinearLayout getTranslationY.

Prototype

@ViewDebug.ExportedProperty(category = "drawing")
public float getTranslationY() 

Source Link

Document

The vertical location of this view relative to its #getTop() top position.

Usage

From source file:org.mythtv.client.ui.BackendStatusFragment.java

private void animateCardLinearLayout(final LinearLayout linearLayout, long startDelay) {
    linearLayout.setAlpha(1);/*from   ww  w .  j a  v  a  2s .c  om*/

    // animator that translates linearlayout
    AnimatorUpdateListener translationAnimatorListener = new AnimatorUpdateListener() {

        /* (non-Javadoc)
         * @see android.animation.ValueAnimator.AnimatorUpdateListener#onAnimationUpdate(android.animation.ValueAnimator)
         */
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Float w = (Float) animation.getAnimatedValue();
            linearLayout.setTranslationY(w);
        }

    };

    ValueAnimator scaleAnimator = ValueAnimator.ofFloat(linearLayout.getTranslationY(), 0f);
    scaleAnimator.setDuration(500);
    scaleAnimator.setRepeatCount(0);
    scaleAnimator.setStartDelay(startDelay);
    scaleAnimator.addUpdateListener(translationAnimatorListener);

    scaleAnimator.start();
}