私はView
を持っています。これにRotateAnimation
を追加しました。それは完全に動作しています。私が持っている唯一の質問は、あらゆる角度の変化を聞く方法があるということです。私は、私がAnimationListener
を追加し、次のリスナーを使用することができますRotateAnimation:すべての角度変更を聞く
rotateAnimation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
を知っているし、また、私は、ビューの角度を取得するためにView.getRotation()
を使用することができます。しかし、アプリの機能は、ユーザーが選択した環境設定から計算された時間を変更します。
私が探しているのは、あらゆる角度の変化を聞くことができるリスナーです。 何かのように、onRotateAngleChange(int currentAngle)
。 私が使用できるそのような方法や回避策に関する指針は大きな助けになるでしょう。
よろしくお願いいたします。
EDIT:最終ヒント/コードです。 @yakobomのポインタのおかげで。
rotateAnimation = new RotateAnimation(fromDegrees, toDegrees){
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
float degrees = fromDegrees + ((toDegrees - fromDegrees) * interpolatedTime);
//Do what you want to do with your angle here.
}
};
ねえ、リアルタイムの角度をどこから得ることができるのか詳しく教えてください。私は 'interpolatedTime'や' t'をどういう意味ですか?私はそれを探しましたが、何も見つかりませんでした。 –
ありがとうございました。あなたが何を意味するのかを理解するために、Rotate AnimationのJavaコードを調べなければなりませんでした。 (Y)。 –
よかった、うまくいけばうれしいよ。 – yakobom