Java Code Examples for android.widget.ImageView.setTranslationY()

The following are Jave code examples for showing how to use setTranslationY() of the android.widget.ImageView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ECardFlow   File: CrossMoveAnimMode.java   View Source Code Vote up 6 votes
@Override
public void transformPage(ImageView ivBg, float position, int direction) {
    ivBg.setScaleX(mScale);
    ivBg.setScaleY(mScale);
    float totalMoveWidth = ivBg.getWidth() * ((mScale - 1) / 2);
    int lastPosition = Math.round(position);
    float mFraction;
    if (lastPosition % 2 == 0) {
        mFraction = -1 * (float) Math.sin(Math.PI * position);
    } else {
        mFraction = (float) Math.sin(Math.PI * position);
    }
    ivBg.setTranslationY(totalMoveWidth * mFraction);
}
 
Example 2
Project: KTools   File: FloatingActionButtonBehavior.java   View Source Code Vote up 5 votes
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, ImageView child, View dependency) {
    float translationY = dependency.getTranslationY() - dependency.getHeight();
    child.setTranslationY(translationY);
    return true;
}