コードで android.animation.AnimatorListenerAdapter クラスを使用して、アニメーションをリッスンしました。例 :
downView.animate().translationX(-mViewWidth).setDuration(mAnimationTime).
setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(
Animator animation) {
boolean real_dismiss = true;
performDismiss(
//some code
)
}
nineoldandroids による下位互換性ライブラリを使用しました。アニメーションは正常に動作しますが、次のエラーが発生し、リスナーでコードを実行できません。
ViewPropertyAnimator 型のメソッド setListener(Animator.AnimatorListener) は引数に適用できません (new AnimatorListenerAdapter(){})
API レベル 11 を使用していたとき、コードは正常に機能していました。私の古いインポート ステートメントは次のとおりです。
//import android.animation.Animator;
//import android.animation.AnimatorListenerAdapter;
//import android.animation.ValueAnimator;
私の新しいインポートステートメント:
import com.nineoldandroids.animation.*;
import com.nineoldandroids.*;