start Scale With Thumb - Android Animation

Android examples for Animation:Scale Animation

Description

start Scale With Thumb

Demo Code


//package com.java2s;

import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;

import android.view.View;

import android.view.animation.LinearInterpolator;

public class Main {
    public static void startScaleWithThumb(View thumbView, boolean isActive) {
        float coefficient = isActive ? 0.8f : 1.0f;
        ObjectAnimator scale = ObjectAnimator.ofPropertyValuesHolder(
                thumbView,/*  w ww. java  2  s.c  o  m*/
                PropertyValuesHolder.ofFloat("scaleX", coefficient),
                PropertyValuesHolder.ofFloat("scaleY", coefficient));
        scale.setDuration(thumbView.getResources().getInteger(
                android.R.integer.config_shortAnimTime));
        scale.setInterpolator(new LinearInterpolator());
        scale.start();
    }
}

Related Tutorials