本文整理汇总了Java中android.view.animation.Animation类的典型用法代码示例。如果您正苦于以下问题:Java Animation类的具体用法?Java Animation怎么用?Java Animation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Animation类属于android.view.animation包,在下文中一共展示了Animation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import android.view.animation.Animation; //导入依赖的package包/类
public void open() {
AnimationSet animationSet = new AnimationSet(true);
animationSet.setDuration(duration);
animationSet.setAnimationListener(this);
animationSet.setFillAfter(true);
RotateAnimation rotateAnimation = new RotateAnimation(270, 360,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(rotateAnimation);
Animation scaleAnimation = new ScaleAnimation(1.25f, 1f, 1.25f, 1f,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
animationSet.addAnimation(scaleAnimation);
imageView.startAnimation(animationSet);
AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator animator1 = ObjectAnimator.ofInt(mLinearLayout, "width", 0, mLinearLayoutWidth);
ObjectAnimator animator2 = ObjectAnimator.ofInt(mLinearLayout, "paddingLeft", 0, savePaddingLeft);
ObjectAnimator animator3 = ObjectAnimator.ofInt(mLinearLayout, "paddingRight", 0, savePaddingRight);
ObjectAnimator animator4 = ObjectAnimator.ofInt(mLinearLayout, "marginLeft", 0, saveMarginLeft);
ObjectAnimator animator5 = ObjectAnimator.ofInt(mLinearLayout, "marginRight", 0, saveMarginRight);
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5);
animatorSet.setDuration(duration).start();
}
示例2: startShowContinueIconAnimations
import android.view.animation.Animation; //导入依赖的package包/类
private AnimationSet startShowContinueIconAnimations() {
Animation mScaleAnimation = new ScaleAnimation(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
Animation mRotateAnimation = new RotateAnimation(
0, 360,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f
);
mRotateAnimation.setRepeatCount(0);
AnimationSet mAnimations = new AnimationSet(true);
mAnimations.setDuration(REVEAL_ANIMATION_DURATION);
mAnimations.setFillAfter(true);
mAnimations.setInterpolator(new OvershootInterpolator(1.5f));
mAnimations.addAnimation(mScaleAnimation);
mAnimations.addAnimation(mRotateAnimation);
mContinueIcon.startAnimation(mAnimations);
return mAnimations;
}
示例3: generateLineRTLAnimation
import android.view.animation.Animation; //导入依赖的package包/类
private Animation generateLineRTLAnimation(final RectF rectF, long offset) {
final float currentLeft = rectF.left;
final float currentRight = rectF.right;
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
rectF.set(currentLeft + (currentRight - currentLeft) / 2 * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
} else {
rectF.set(currentLeft - (currentRight - currentLeft) * interpolatedTime, rectF.top, rectF.right, rectF.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration());
animation.setStartOffset(offset);
return animation;
}
示例4: finishDialogAnim
import android.view.animation.Animation; //导入依赖的package包/类
/**
* 销毁对话框的动画
*/
private void finishDialogAnim(final ViewPattern dialogPattern, final Animation animation, final Runnable end) {
/*是否变暗*/
if (dialogPattern.mIView.isDimBehind()) {
AnimUtil.startArgb(dialogPattern.mIView.getDialogDimView(),
dialogPattern.mIView.getDimColor(), Color.TRANSPARENT, DEFAULT_ANIM_TIME);
}
final View animView = dialogPattern.mIView.getAnimView();
final Runnable endRunnable = new Runnable() {
@Override
public void run() {
dialogPattern.mView.setAlpha(0);
dialogPattern.mView.setVisibility(INVISIBLE);
end.run();
}
};
safeStartAnim(animView, animation, endRunnable, true);
}
示例5: onPasscodeError
import android.view.animation.Animation; //导入依赖的package包/类
protected void onPasscodeError() {
Encryptor.snackPeak(mActivity,getString(R.string.passcode_wrong));
Thread thread = new Thread() {
public void run() {
Animation animation = AnimationUtils.loadAnimation(
LockActivity.this, R.anim.shake);
findViewById(R.id.ll_applock).startAnimation(animation);
codeField1.setText("");
codeField2.setText("");
codeField3.setText("");
codeField4.setText("");
codeField1.requestFocus();
}
};
runOnUiThread(thread);
}
示例6: expand
import android.view.animation.Animation; //导入依赖的package包/类
private void expand(final View v) {
v.measure(-1, -2);
final int targetHeight = v.getMeasuredHeight();
v.getLayoutParams().height = 0;
v.setVisibility(0);
this.animation = new Animation() {
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1.0f) {
ExpandableLayout.this.isOpened = Boolean.valueOf(true);
}
v.getLayoutParams().height = interpolatedTime == 1.0f ? -2 : (int) (((float)
targetHeight) * interpolatedTime);
v.requestLayout();
}
public boolean willChangeBounds() {
return true;
}
};
this.animation.setDuration((long) this.duration.intValue());
v.startAnimation(this.animation);
}
示例7: animateSides
import android.view.animation.Animation; //导入依赖的package包/类
/**
* Animating the sides of the row, For example animating the user profile image and the message date.
* */
private void animateSides(View view, boolean fromLeft, Animation.AnimationListener animationListener){
if (!isScrolling)
return;
if (fromLeft)
view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_left));
else view.setAnimation(AnimationUtils.loadAnimation(mActivity, R.anim.expand_slide_form_right));
view.getAnimation().setAnimationListener(animationListener);
view.animate();
}
示例8: show
import android.view.animation.Animation; //导入依赖的package包/类
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
if (this.mView.getVisibility() != 0 || this.mIsHiding) {
this.mView.clearAnimation();
this.mView.internalSetVisibility(0, fromUser);
Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
anim.setDuration(200);
anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
anim.setAnimationListener(new AnimationListenerAdapter() {
public void onAnimationEnd(Animation animation) {
if (listener != null) {
listener.onShown();
}
}
});
this.mView.startAnimation(anim);
} else if (listener != null) {
listener.onShown();
}
}
示例9: startLoadingAnimation
import android.view.animation.Animation; //导入依赖的package包/类
private void startLoadingAnimation(ImageView imageView) {
RotateAnimation loadingAnimation =
new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
loadingAnimation.setDuration(1000);
loadingAnimation.setRepeatCount(-1);
loadingAnimation.setInterpolator(new LinearInterpolator());
imageView.setAnimation(loadingAnimation);
loadingAnimation.start();
}
示例10: startScaleUpAnimation
import android.view.animation.Animation; //导入依赖的package包/类
private void startScaleUpAnimation(AnimationListener listener) {
mCircleView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
// Pre API 11, alpha is used in place of scale up to show the
// progress circle appearing.
// Don't adjust the alpha during appearance otherwise.
mProgress.setAlpha(MAX_ALPHA);
}
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
if (listener != null) {
mCircleView.setAnimationListener(listener);
}
mCircleView.clearAnimation();
mCircleView.startAnimation(mScaleAnimation);
}
示例11: RotateLoadingLayout
import android.view.animation.Animation; //导入依赖的package包/类
public RotateLoadingLayout(Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
super(context, mode, scrollDirection, attrs);
mRotateDrawableWhilePulling = attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);
mHeaderImage.setScaleType(ScaleType.MATRIX);
mHeaderImageMatrix = new Matrix();
mHeaderImage.setImageMatrix(mHeaderImageMatrix);
mRotateAnimation = new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
mRotateAnimation.setRepeatCount(Animation.INFINITE);
mRotateAnimation.setRepeatMode(Animation.RESTART);
}
示例12: expand
import android.view.animation.Animation; //导入依赖的package包/类
public void expand() {
if (!isExpand) {
isExpand = true;
mText.setTextColor(Color.TRANSPARENT);
mExpandText.setTextColor(mTextColor);
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
ViewGroup.LayoutParams params = ExpandTextView.this.getLayoutParams();
params.height = mStart + (int) ((mEnd - mStart) * interpolatedTime);
setLayoutParams(params);
}
};
animation.setDuration(500);
startAnimation(animation);
}
}
示例13: initView
import android.view.animation.Animation; //导入依赖的package包/类
private void initView(Context context) {
mContent = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.rfv_header, this);
imgDirectionArrow = (ImageView) findViewById(R.id.imgDirectionArrow);
tvRefreshState = (TextView) findViewById(R.id.tvRefreshState);
tvLastRefreshTime = (TextView) findViewById(R.id.tvLastRefreshTime);
mProgressBar = (ProgressBar) findViewById(R.id.rfv_header_progressbar);
mRotateUpAnim = new RotateAnimation(0.0f, -180.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateUpAnim.setFillAfter(true);
mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
mRotateDownAnim.setFillAfter(true);
}
示例14: wrap
import android.view.animation.Animation; //导入依赖的package包/类
public static View10 wrap(View view) {
View10 proxy = PROXIES.get(view);
Animation animation = view.getAnimation();
if (proxy == null || proxy != animation && animation != null) {
proxy = new View10(view);
PROXIES.put(view, proxy);
} else if (animation == null) {
view.setAnimation(proxy);
}
return proxy;
}
示例15: animationIn
import android.view.animation.Animation; //导入依赖的package包/类
public static void animationIn(final View view, final int animation, int delayTime, final Context context) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
Animation inAnimation = AnimationUtils.loadAnimation(
context.getApplicationContext(), animation);
view.setAnimation(inAnimation);
view.setVisibility(View.VISIBLE);
}
}, delayTime);
}