android ボタン アニメーション ScaleAnimation

◯ScaleAnimation 変数 = new ScaleAnimation

 

◯setDuration(1000);  // アニメーションを行う時間を設定

 

◯setInterpolator(new setInterpolator(0.5f));  // アニメーションを繰り返す回数を設定

 

◯startAnimation() // アニメーションのスタート

 // イベントリスナーをボタンに登録
((Button)findViewById(R.id.button)).setOnClickListener(new View.OnClickListener(){

// アニメーションを実行するコールバックメソッドの定義
@Override
public void onClick(View view) {

ScaleAnimation scale = new ScaleAnimation(
0.5f,
10.0f,
0.5f,
10.0f,
view.getWidth() / 2,
view.getHeight() / 2
);
// アニメーションを行う時間を設定
scale.setDuration(1000);
// アニメーションを繰り返す回数を設定
scale.setInterpolator(new CycleInterpolator(0.5f));
// アニメーションスタート
view.startAnimation(scale);
}

});