本文整理匯總了Java中android.view.animation.Animation.setStartTime方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setStartTime方法的具體用法?Java Animation.setStartTime怎麽用?Java Animation.setStartTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.setStartTime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: animationDisplay
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animationDisplay(ImageView imageView,Bitmap bitmap,Animation animation){
animation.setStartTime(AnimationUtils.currentAnimationTimeMillis());
imageView.setImageBitmap(bitmap);
imageView.startAnimation(animation);
}
示例2: animateIn
import android.view.animation.Animation; //導入方法依賴的package包/類
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
if (view.getVisibility() == View.VISIBLE) return;
view.clearAnimation();
animation.reset();
animation.setStartTime(0);
view.setVisibility(View.VISIBLE);
view.startAnimation(animation);
}
示例3: center
import android.view.animation.Animation; //導入方法依賴的package包/類
protected void center(boolean vertical, boolean horizontal, boolean animate) {
if (mBitmap == null)
return;
Matrix m = getImageViewMatrix();
float [] topLeft = new float[] { 0, 0 };
float [] botRight = new float[] { mBitmap.getWidth(), mBitmap.getHeight() };
translatePoint(m, topLeft);
translatePoint(m, botRight);
float height = botRight[1] - topLeft[1];
float width = botRight[0] - topLeft[0];
float deltaX = 0, deltaY = 0;
if (vertical) {
int viewHeight = getHeight();
if (height < viewHeight) {
deltaY = (viewHeight - height)/2 - topLeft[1];
} else if (topLeft[1] > 0) {
deltaY = -topLeft[1];
} else if (botRight[1] < viewHeight) {
deltaY = getHeight() - botRight[1];
}
}
if (horizontal) {
int viewWidth = getWidth();
if (width < viewWidth) {
deltaX = (viewWidth - width)/2 - topLeft[0];
} else if (topLeft[0] > 0) {
deltaX = -topLeft[0];
} else if (botRight[0] < viewWidth) {
deltaX = viewWidth - botRight[0];
}
}
postTranslate(deltaX, deltaY);
if (animate) {
Animation a = new TranslateAnimation(-deltaX, 0, -deltaY, 0);
a.setStartTime(SystemClock.elapsedRealtime());
a.setDuration(250);
setAnimation(a);
}
setImageMatrix(getImageViewMatrix());
}
示例4: center
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
protected void center(boolean vertical, boolean horizontal, boolean animate) {
if (mBitmap == null)
return;
if (selection == null) {
invalidate();
return;
}
Matrix m = getImageViewMatrix();
float[] topLeft = new float[]{0, 0};
float[] botRight = new float[]{mBitmap.getWidth(), mBitmap.getHeight()};
translatePoint(m, topLeft);
translatePoint(m, botRight);
float deltaX = 0, deltaY = 0;
if (vertical) {
if (topLeft[1] > selection.bottom) {
deltaY = selection.bottom - topLeft[1];
} else if (botRight[1] < selection.top) {
deltaY = selection.top - botRight[1];
}
}
if (horizontal) {
if (topLeft[0] > selection.right) {
deltaX = selection.right - topLeft[0];
} else if (botRight[0] < selection.left) {
deltaX = selection.left - botRight[0];
}
}
postTranslate(deltaX, deltaY);
if (animate) {
Animation a = new TranslateAnimation(-deltaX, 0, -deltaY, 0);
a.setStartTime(SystemClock.elapsedRealtime());
a.setDuration(250);
setAnimation(a);
}
setImageMatrix(getImageViewMatrix());
}