Example usage for android.widget TextView setTranslationY

List of usage examples for android.widget TextView setTranslationY

Introduction

In this page you can find the example usage for android.widget TextView setTranslationY.

Prototype

public void setTranslationY(float translationY) 

Source Link

Document

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

Usage

From source file:ugia.io.androidbeautytreatment.viewcontroller.fragment.ViewPagerFragment.java

private void transformTextViews(float progress, int currentPage) {

    TextView textView = userDetailsTextViews[currentPage];
    float translationY;

    if (progress < -1) { // [-Infinity,-1)
        translationY = viewPagerHeaderHeight * 2;

    } else if (progress <= 1) { // (0,1]
        translationY = progress * -viewPagerHeaderHeight * 2;

    } else { // (1,+Infinity]
        translationY = -viewPagerHeaderHeight * 2;
    }//from ww w  .  java2s .co m

    textView.setTranslationY(translationY);
}

From source file:com.android.tv.menu.MenuLayoutManager.java

private void setTempTitleView(TextView dest, TextView src) {
    dest.setVisibility(View.VISIBLE);
    dest.setText(src.getText());/*w w w  .j  a  v a  2s  . c o  m*/
    dest.setTranslationY(0.0f);
    if (src.getVisibility() == View.VISIBLE) {
        dest.setAlpha(src.getAlpha());
        dest.setScaleX(src.getScaleX());
        dest.setScaleY(src.getScaleY());
    } else {
        dest.setAlpha(0.0f);
        dest.setScaleX(1.0f);
        dest.setScaleY(1.0f);
    }
    View parent = (View) src.getParent();
    dest.setLeft(src.getLeft() + parent.getLeft());
    dest.setRight(src.getRight() + parent.getLeft());
    dest.setTop(src.getTop() + parent.getTop());
    dest.setBottom(src.getBottom() + parent.getTop());
}

From source file:info.bartowski.easteregg.LLand.java

public void setScoreField(TextView tv) {
    mScoreField = tv;/*from   ww  w  .  j  a  v a  2s.  c  o m*/
    if (tv != null) {
        ViewCompat.setTranslationZ(tv, PARAMS.HUD_Z);
        if (!(mAnimating && mPlaying)) {
            tv.setTranslationY(-500);
        }
    }
}