本文整理匯總了Java中android.view.animation.RotateAnimation.setAnimationListener方法的典型用法代碼示例。如果您正苦於以下問題:Java RotateAnimation.setAnimationListener方法的具體用法?Java RotateAnimation.setAnimationListener怎麽用?Java RotateAnimation.setAnimationListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.RotateAnimation
的用法示例。
在下文中一共展示了RotateAnimation.setAnimationListener方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addImages
import android.view.animation.RotateAnimation; //導入方法依賴的package包/類
private void addImages() {
int imageSize = chessboardView.getThickness();
for (int i = 0; i < gridSize; i++) {
for (int j = 0; j < gridSize; j++) {
if (figuren[i][j] != null) {
Point point = chessboardView.getRectangleCoordinates(new Tuple<>(i, j));
figuren[i][j].setX(point.x);
figuren[i][j].setY(point.y);
addContentView(figuren[i][j], new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
figuren[i][j].getLayoutParams().width = imageSize;
figuren[i][j].getLayoutParams().height = imageSize;
if (!aiGame) {
if (!startValue.equals(board.getBoard())) {
int pivotX = point.x + imageSize / 2;
int pivotY = point.y + imageSize / 2;
RotateAnimation rotateAnimation = new RotateAnimation(180, 0, pivotX, pivotY);
rotateAnimation.setDuration(ANIMATION_SPEED / 2);
rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
rotateAnimation.setAnimationListener(new AnimationEndListener() {
@Override
public void onAnimationEnd(Animation animation) {
stateAllowClick = true;
}
});
figuren[i][j].startAnimation(rotateAnimation);
}
if (board.isWhitesTurn()) {
figuren[i][j].setRotation(0);
} else {
figuren[i][j].setRotation(180);
}
}
}
}
}
}
示例2: getRotateAnimation
import android.view.animation.RotateAnimation; //導入方法依賴的package包/類
/**
* Get a spin animation
*
* @param fromDegrees start angle
* @param toDegrees end angle
* @param pivotXType Rotation center point X axis coordinate relative type
* @param pivotXValue Rotation center point X axis coordinate
* @param pivotYType Rotation center point Y axis coordinate relative type
* @param pivotYValue Rotation center point Y axis coordinate
* @param durationMillis duration
* @param animationListener Animation monitor
* @return A rotating animation
*/
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, Animation.AnimationListener animationListener) {
RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees,
toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
rotateAnimation.setDuration(durationMillis);
if (animationListener != null)
rotateAnimation.setAnimationListener(animationListener);
return rotateAnimation;
}
示例3: getRotateAnimation
import android.view.animation.RotateAnimation; //導入方法依賴的package包/類
/**
* 獲取一個旋轉動畫
*
* @param fromDegrees 開始角度
* @param toDegrees 結束角度
* @param pivotXType 旋轉中心點X軸坐標相對類型
* @param pivotXValue 旋轉中心點X軸坐標
* @param pivotYType 旋轉中心點Y軸坐標相對類型
* @param pivotYValue 旋轉中心點Y軸坐標
* @param durationMillis 持續時間
* @param animationListener 動畫監聽器
* @return 一個旋轉動畫
*/
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) {
RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
rotateAnimation.setDuration(durationMillis);
if (animationListener != null) {
rotateAnimation.setAnimationListener(animationListener);
}
return rotateAnimation;
}