Example usage for android.view View setScaleX

List of usage examples for android.view View setScaleX

Introduction

In this page you can find the example usage for android.view View setScaleX.

Prototype

public void setScaleX(float scaleX) 

Source Link

Document

Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.

Usage

From source file:Main.java

public static void onCompare(View v) {
    v.setScaleX(0f);
    v.setScaleY(0f);//from  www  .  j a v a 2  s. c om
    v.animate().setInterpolator(new OvershootInterpolator()).scaleX(1).scaleY(1).setDuration(150);
}

From source file:Main.java

public static void animateScaleIn(View view, long duration, Animator.AnimatorListener listener) {
    view.setScaleX(0f);
    view.setScaleY(0f);/*from  w w  w.ja  v  a2 s . c o  m*/
    view.setVisibility(View.VISIBLE);

    AnimatorSet scaleSet = new AnimatorSet();
    scaleSet.playTogether(ObjectAnimator.ofFloat(view, View.SCALE_X, 1f),
            ObjectAnimator.ofFloat(view, View.SCALE_Y, 1f));
    scaleSet.setInterpolator(new AccelerateDecelerateInterpolator());
    scaleSet.setDuration(duration);
    if (listener != null) {
        scaleSet.addListener(listener);
    }
    scaleSet.start();
    //return scaleSet;
}

From source file:Main.java

public static void animateScaleOut(final View view) {
    if (!view.isShown()) {
        view.setScaleX(0.2f);
        view.setScaleY(0.2f);/*ww w .ja v  a 2s  .  c  o m*/
        view.animate().setStartDelay(200).alpha(1).scaleX(1).scaleY(1)
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        view.setVisibility(View.VISIBLE);
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }
                });
    }
}

From source file:com.grottworkshop.gwsmaterialviewpagerreg.Utils.java

/**
 * modify the scale of multiples views//from w  w w .j  ava  2  s  . c o  m
 * @param scale the new scale
 * @param views the views
 */
public static void setScale(float scale, View... views) {
    for (View view : views) {
        if (view != null) {
            view.setScaleX(scale);
            view.setScaleY(scale);
        }
    }
}

From source file:Main.java

public static void scaleView(View view, float originalSize, float finalSize, float percent) {
    float calcSize = (finalSize - originalSize) * percent + originalSize;
    float caleScale = calcSize / originalSize;
    view.setScaleX(caleScale);
    view.setScaleY(caleScale);/*www  .  jav  a2s.c  o  m*/
}

From source file:by.gdgminsk.animationguide.util.AnimUtils.java

public static void scaleIn(final View view, int delay) {
    view.setAlpha(0.0f);//  w w w .  jav  a 2  s.  c om
    view.setScaleX(0.0f);
    view.setScaleY(0.0f);
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 1.0f);
    PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1.0f);
    PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1.0f);
    ObjectAnimator scaleInAnimation = ObjectAnimator.ofPropertyValuesHolder(view, alpha, scaleX, scaleY);
    scaleInAnimation.setDuration(view.getResources().getInteger(R.integer.duration_fab_scale_in));
    scaleInAnimation.setStartDelay(delay);
    scaleInAnimation.setInterpolator(EASE_IN_INTERPOLATOR);
    scaleInAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            view.setAlpha(1.0f);
            view.setScaleX(1.0f);
            view.setScaleY(1.0f);
        }
    });
    scaleInAnimation.start();
}

From source file:Main.java

private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs,
        int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) {
    view.setScaleX(startScaleValue);
    view.setScaleY(startScaleValue);//from w ww. j av a 2 s  .  co  m

    final ViewPropertyAnimator animator = view.animate();
    animator.cancel();

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
        animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue)
                .setListener(listener);
    } else {
        animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener)
                .withLayer();
    }
    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.setStartDelay(startDelay);

    animator.start();
}

From source file:com.kogitune.activitytransition.core.TransitionAnimation.java

private static void runEnterAnimation(MoveData moveData, TimeInterpolator interpolator) {
    final View toView = moveData.toView;
    toView.setPivotX(0);//from  w  w  w  . j a  v a  2  s  . c  om
    toView.setPivotY(0);
    toView.setScaleX(moveData.widthScale);
    toView.setScaleY(moveData.heightScale);
    toView.setTranslationX(moveData.leftDelta);
    toView.setTranslationY(moveData.topDelta);

    toView.animate().setDuration(moveData.duration).scaleX(1).scaleY(1).translationX(0).translationY(0)
            .setInterpolator(interpolator);
}

From source file:Main.java

private static void scaleInternal(final View view, int startScaleValue, int endScaleValue, int durationMs,
        int startDelay, AnimatorListenerAdapter listener, Interpolator interpolator) {
    view.setScaleX(startScaleValue);
    view.setScaleY(startScaleValue);// w ww  .ja  v a  2 s.  c o  m

    final ViewPropertyAnimator animator = view.animate();
    animator.cancel();

    animator.setInterpolator(interpolator).scaleX(endScaleValue).scaleY(endScaleValue).setListener(listener)
            .withLayer();

    if (durationMs != DEFAULT_DURATION) {
        animator.setDuration(durationMs);
    }
    animator.setStartDelay(startDelay);

    animator.start();
}

From source file:me.lizheng.deckview.helpers.DeckChildViewTransform.java

/**
 * Reset the transform on a view./*w  ww. j a  va  2s .c om*/
 */
public static void reset(View v) {
    v.setTranslationX(0f);
    v.setTranslationY(0f);
    ViewCompat.setTranslationZ(v, 0f);
    v.setScaleX(1f);
    v.setScaleY(1f);
    v.setAlpha(1f);
}