本文整理匯總了Java中android.view.animation.Animation.setFillAfter方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setFillAfter方法的具體用法?Java Animation.setFillAfter怎麽用?Java Animation.setFillAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.setFillAfter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onFocusChange
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public void onFocusChange(View v, boolean hasFocus) {
int focus = 0;
if (hasFocus) {
focus = R.anim.enlarge;
} else {
focus = R.anim.decrease;
}
//如果有焦點就放大,沒有焦點就縮小
Animation mAnimation = AnimationUtils.loadAnimation(
getActivity().getApplication(), focus);
mAnimation.setBackgroundColor(Color.TRANSPARENT);
mAnimation.setFillAfter(hasFocus);
v.startAnimation(mAnimation);
mAnimation.start();
v.bringToFront();
}
示例2: createShrinkAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例3: createShrinkAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setFillAfter(true);
final long preDuration = duration / 2;
Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setStartOffset(startOffset);
rotateAnimation.setDuration(preDuration);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setFillAfter(true);
animationSet.addAnimation(rotateAnimation);
Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
translateAnimation.setStartOffset(startOffset + preDuration);
translateAnimation.setDuration(duration - preDuration);
translateAnimation.setInterpolator(interpolator);
translateAnimation.setFillAfter(true);
animationSet.addAnimation(translateAnimation);
return animationSet;
}
示例4: bottomViewRemove
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* 底部視圖 銷毀
*/
private void bottomViewRemove(final ViewPattern bottomViewPattern,
final ViewPattern topViewPattern,
final Runnable endRunnable,
boolean isRemove,/*是否需要移除bottomViewPattern*/
final UIParam param) {
if (bottomViewPattern == null) {
return;
}
bottomViewPattern.isAnimToStart = false;
if (bottomViewPattern.mView instanceof ILifecycle) {
((ILifecycle) bottomViewPattern.mView).onLifeViewHide();
}
if (topViewPattern.mIView.isDialog() && !isRemove) {
//對話框彈出的時候, 底部IView 不執行周期
} else {
if (!RApplication.isLowDevice || param.mAnim) {
final Animation animation = topViewPattern.mIView.loadOtherExitAnimation();
if (animation != null) {
animation.setFillAfter(false);
}
safeStartAnim(bottomViewPattern.mIView.getAnimView(), animation, endRunnable, true);
} else {
endRunnable.run();
}
}
}
示例5: setActivityToolbarPosition
import android.view.animation.Animation; //導入方法依賴的package包/類
public static void setActivityToolbarPosition(int duration, Toolbar aMainToolbar, Toolbar aDecorativeToolbar, Activity aActivity, float fromToolbarPosition, float toToolbarPosition, float fromMainToolbarPosition, float toMainToolbarPosition) {
duration = duration < 0 ? 0 : duration;
float distanceToMoveY = toToolbarPosition - fromToolbarPosition;
float DECORATIVE_TOOLBAR_HEIGHT = -1 * aActivity.getResources().getDimension(R.dimen.additional_toolbar_height);
float toTranslationY = (distanceToMoveY < DECORATIVE_TOOLBAR_HEIGHT) ? DECORATIVE_TOOLBAR_HEIGHT : distanceToMoveY;
// We want to make sure the toolbar is as close to the final position as possible without being visible.
// This ensures that the animation is only running when the toolbar is visible to the user.
if(aDecorativeToolbar.getY() < DECORATIVE_TOOLBAR_HEIGHT) {
aDecorativeToolbar.setY(DECORATIVE_TOOLBAR_HEIGHT);
toTranslationY = (DECORATIVE_TOOLBAR_HEIGHT - toToolbarPosition) * -1;
}
Animation moveToolbarAnimation = new TranslateAnimation(0, 0, 0, toTranslationY);
moveToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveToolbarAnimation.setDuration(duration);
moveToolbarAnimation.setFillAfter(true);
float toDeltaY = toMainToolbarPosition - fromMainToolbarPosition;
Animation moveMainToolbarAnimation = new TranslateAnimation(0, 0, 0, toDeltaY);
moveMainToolbarAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
moveMainToolbarAnimation.setDuration(duration);
moveMainToolbarAnimation.setFillAfter(true);
aMainToolbar.setBackgroundColor(Service.getColorAttribute(R.attr.colorPrimary, R.color.primary, aActivity));
aMainToolbar.startAnimation(moveMainToolbarAnimation);
aDecorativeToolbar.startAnimation(moveToolbarAnimation);
}
示例6: startAlphaRevealAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* For the Card Views
*/
public static AnimationSet startAlphaRevealAnimation(int delay, final View VIEW, boolean includeTransition) {
final int ANIMATION_DURATION = 300;
final Animation mAlphaAnimation = new AlphaAnimation(0f, 1f);
mAlphaAnimation.setDuration(ANIMATION_DURATION);
mAlphaAnimation.setFillAfter(true);
final AnimationSet mRevealAnimations = new AnimationSet(true);
mRevealAnimations.setInterpolator(new AccelerateDecelerateInterpolator());
mRevealAnimations.addAnimation(mAlphaAnimation);
mRevealAnimations.setFillAfter(true);
if (includeTransition) {
final Animation mTransitionAnimation = new TranslateAnimation(0, 0, VIEW.getHeight()/2, 0);
mTransitionAnimation.setDuration(ANIMATION_DURATION);
mTransitionAnimation.setFillAfter(false);
mRevealAnimations.addAnimation(mTransitionAnimation);
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if(VIEW != null)
VIEW.startAnimation(mRevealAnimations);
}
}, delay);
return mRevealAnimations;
}
示例7: showAndSetStreamCount
import android.view.animation.Animation; //導入方法依賴的package包/類
private void showAndSetStreamCount(int count) {
mStreamsCountWrapper.setVisibility(View.VISIBLE);
Animation alphaAnimation = new AlphaAnimation(0f, 1f);
alphaAnimation.setDuration(240);
alphaAnimation.setFillAfter(true);
mStreamsCountWrapper.startAnimation(alphaAnimation);
mStreamsCount.setText(Integer.toString(count));
}
示例8: startProgress
import android.view.animation.Animation; //導入方法依賴的package包/類
public void startProgress() {
actionButtonText.setVisibility(GONE);
actionLoader.setVisibility(View.VISIBLE);
Animation rotationAnim = android.view.animation.AnimationUtils.loadAnimation(getContext(),
R.anim.rotate);
rotationAnim.setFillAfter(true);
actionLoader.startAnimation(rotationAnim);
}
示例9: createExpandAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
long startOffset, long duration, Interpolator interpolator) {
Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
animation.setStartOffset(startOffset);
animation.setDuration(duration);
animation.setInterpolator(interpolator);
animation.setFillAfter(true);
return animation;
}
示例10: OutToBottomAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
public OutToBottomAnimation(Context context, View animView, View nextView) {
this.context = context;
this.nextView = nextView;
this.animView = animView;
Animation animation = AnimationUtils.loadAnimation(context, R.anim.kf5_anim_out_to_bottom);
animation.setAnimationListener(this);
animation.setFillAfter(false);
animView.startAnimation(animation);
}
示例11: onAnimationEnd
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public void onAnimationEnd(Animation animation) {
if (animView.isShown()) {
animView.setVisibility(View.GONE);
}
if (!nextView.isShown()) {
nextView.setVisibility(View.VISIBLE);
}
Animation nextAnimation = AnimationUtils.loadAnimation(context, R.anim.kf5_anim_in_from_bottom);
nextAnimation.setFillAfter(true);
nextView.startAnimation(nextAnimation);
}
示例12: showQueue
import android.view.animation.Animation; //導入方法依賴的package包/類
private void showQueue() {
if (!isShown())
setVisibility(VISIBLE);
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.kf5_anim_in_from_bottom);
animation.setFillAfter(true);
startAnimation(animation);
}
示例13: onCreate
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim_opacity);
animation.setDuration(2000);
animation.setFillAfter(true);
findViewById(R.id.image_splash).setAnimation(animation);
mHandler.sendEmptyMessageDelayed(TO_MAIN, DELAY_TIME);
}
示例14: createHintSwitchAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private static Animation createHintSwitchAnimation(final boolean expanded) {
Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setStartOffset(0);
animation.setDuration(100);
animation.setInterpolator(new DecelerateInterpolator());
animation.setFillAfter(true);
return animation;
}
示例15: getDefaultScaleAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* 生成自定義ScaleAnimation
*/
protected Animation getDefaultScaleAnimation() {
Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(300);
scaleAnimation.setInterpolator(new AccelerateInterpolator());
scaleAnimation.setFillEnabled(true);
scaleAnimation.setFillAfter(true);
return scaleAnimation;
}