0

ある種のアニメーションを使用して画面全体をスムーズに埋めるために「成長」を開始するイメージボタンの中央画面が必要です。フルサイズになったら、アニメーションを逆にして元のサイズに戻しますか?

何か案は?これは可能ですか?

4

1 に答える 1

2

このレイアウト res/anim/animate.xml を使用して、アニメーション用の xml ファイルの作成を開始するためのサンプルを次に示します。

       <?xml version="1.0" encoding="utf-8"?>
        <set xmlns:android="http://schemas.android.com/apk/res/android" 
        android:shareInterpolator="false">
   <scale
    android:interpolator="@android:anim/accelerate_decelerate_interpolator"
    android:fromXScale="1.0"
    android:toXScale="2.0"
    android:fromYScale="1.0"
    android:toYScale="2.0"
    android:repeatMode="reverse"
    android:duration="700" />
    </set>

アニメーションを開始するメソッドでこれを使用します

 Animation scaleAnim = AnimationUtils.loadAnimation(this, R.anim.animate);
view.startAnimation( scaleAnim ); 

アニメーションについて詳しくはこちらアニメーション

于 2012-12-27T20:24:29.673 に答える