本文整理匯總了Java中android.view.animation.TranslateAnimation.setFillAfter方法的典型用法代碼示例。如果您正苦於以下問題:Java TranslateAnimation.setFillAfter方法的具體用法?Java TranslateAnimation.setFillAfter怎麽用?Java TranslateAnimation.setFillAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.TranslateAnimation
的用法示例。
在下文中一共展示了TranslateAnimation.setFillAfter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: translateHeader
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* Translates the adapter in Y
*
* @param of offset in px
*/
public void translateHeader(float of) {
float ofCalculated = of * mScrollMultiplier;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && of < mHeader.getHeight()) {
mHeader.setTranslationY(ofCalculated);
} else if (of < mHeader.getHeight()) {
TranslateAnimation anim = new TranslateAnimation(0, 0, ofCalculated, ofCalculated);
anim.setFillAfter(true);
anim.setDuration(0);
mHeader.startAnimation(anim);
}
mHeader.setClipY(Math.round(ofCalculated));
if (mParallaxScroll != null) {
final RecyclerView.ViewHolder holder = mRecyclerView.findViewHolderForAdapterPosition(0);
float left;
if (holder != null) {
left = Math.min(1, ((ofCalculated) / (mHeader.getHeight() * mScrollMultiplier)));
}else {
left = 1;
}
mParallaxScroll.onParallaxScroll(left, of, mHeader);
}
}
示例2: getStartAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* 獲得入場動畫
*
* @return
*/
protected Animation getStartAnimation() {
AlphaAnimation animAlpha = new AlphaAnimation(0, 1);
animAlpha.setDuration(TIME_START_ANIM);
animAlpha.setFillAfter(true);
TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 1.5f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f);
animTrans.setDuration(TIME_START_ANIM);
animTrans.setFillAfter(true);
animTrans.setInterpolator(new DecelerateInterpolator());
AnimationSet sets = new AnimationSet(true);
sets.addAnimation(animAlpha);
sets.addAnimation(animTrans);
return sets;
}
示例3: getEndAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* 獲得離場動畫
*
* @return
*/
protected Animation getEndAnimation() {
AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
animAlpha.setDuration(TIME_END_ANIM);
animAlpha.setFillAfter(true);
TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, -1.5f,
Animation.RELATIVE_TO_PARENT, 0f,
Animation.RELATIVE_TO_PARENT, 0f);
animTrans.setDuration(TIME_END_ANIM);
animTrans.setFillAfter(true);
animTrans.setInterpolator(new AccelerateInterpolator());
AnimationSet sets = new AnimationSet(true);
sets.addAnimation(animAlpha);
sets.addAnimation(animTrans);
return sets;
}
示例4: createTranslationOutAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private Animation createTranslationOutAnimation() {
int type = TranslateAnimation.RELATIVE_TO_SELF;
TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type, 0, type, 1);
an.setDuration(TRANSLATE_DURATION);
an.setFillAfter(true);
return an;
}
示例5: trans
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private void trans(long dura, float frX, float toX) {
TranslateAnimation animation = new TranslateAnimation(frX, toX, 0.0F, 0.0F);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(dura);
animation.setFillAfter(true);
vTrans.startAnimation(animation);
}
示例6: setExitAnimRightMargin
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
@Override
public void setExitAnimRightMargin(float dp) {
int rightmargin =UIUtils.dip2ipx(dp);
mExitAnim = new TranslateAnimation(0, DEFAULT_WIDTH + rightmargin, 0, 0);
mExitAnim.setFillAfter(true);
mExitAnim.setDuration(DURATION_ENTER_EXIT);
mExitAnim.setAnimationListener(this);
}
示例7: animationAtEnd
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private void animationAtEnd() {
mGridName.setEnabled(false);
TranslateAnimation animate = new TranslateAnimation(mEditButton.getWidth(), 0, 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
mEditButton.startAnimation(animate);
mEditButton.setVisibility(View.VISIBLE);
}
示例8: animationAtStart
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private void animationAtStart() {
mGridName.setEnabled(true);
TranslateAnimation animate = new TranslateAnimation(0, mEditButton.getWidth(), 0, 0);
animate.setDuration(500);
animate.setFillAfter(true);
mEditButton.startAnimation(animate);
mEditButton.setVisibility(View.GONE);
}
示例9: getTranslateAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* 位移 Translate
*/
public static Animation getTranslateAnimation(float fromXDelta,
float toXDelta, float fromYDelta, float toYDelta,
long durationMillis) {
TranslateAnimation translate = new TranslateAnimation(fromXDelta,
toXDelta, fromYDelta, toYDelta);
translate.setDuration(durationMillis);
translate.setFillAfter(true);
return translate;
}
示例10: getMoveAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* 獲取移動的動畫
*/
public Animation getMoveAnimation(float toXValue, float toYValue) {
TranslateAnimation mTranslateAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0F,
Animation.RELATIVE_TO_SELF, toXValue,
Animation.RELATIVE_TO_SELF, 0.0F,
Animation.RELATIVE_TO_SELF, toYValue);// 當前位置移動到指定位置
mTranslateAnimation.setFillAfter(true);// 設置一個動畫效果執行完畢後,View對象保留在終止的位置。
mTranslateAnimation.setDuration(300L);
return mTranslateAnimation;
}
示例11: createTranslationOutAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private Animation createTranslationOutAnimation() {
int type = TranslateAnimation.RELATIVE_TO_SELF;
TranslateAnimation an = new TranslateAnimation(type, 0, type, 0, type,
0, type, 1);
an.setDuration(TRANSLATE_DURATION);
an.setFillAfter(true);
return an;
}
示例12: startAlphaAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
public static void startAlphaAnimation(View v, int height, int visibility) {
TranslateAnimation translateAnimation = (visibility == View.GONE)
? new TranslateAnimation(0, 0, 0, -height)
: new TranslateAnimation(0, 0, 0, 0);
translateAnimation.setDuration(ALPHA_ANIMATIONS_DURATION);
translateAnimation.setFillAfter(true);
v.startAnimation(translateAnimation);
}
示例13: ApplyHorizontalScrollAnimation
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
float sign = left ? 1f : -1f;
AnimationSet animationSet = new AnimationSet(true);
animationSet.setRepeatCount(Animation.INFINITE);
animationSet.setRepeatMode(Animation.RESTART);
TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
Animation.RELATIVE_TO_PARENT, 0);
move.setStartOffset(0);
move.setDuration(speed);
move.setFillAfter(true);
animationSet.addAnimation(move);
view.startAnimation(animationSet);
}
示例14: getTranslateAnimator
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
/**
* 獲取位移動畫
*/
private TranslateAnimation getTranslateAnimator(float targetX, float targetY) {
TranslateAnimation translateAnimation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0f,
Animation.ABSOLUTE, targetX,
Animation.RELATIVE_TO_SELF, 0f,
Animation.ABSOLUTE, targetY);
// RecyclerView默認移動動畫250ms 這裏設置360ms 是為了防止在位移動畫結束後 remove(view)過早 導致閃爍
translateAnimation.setDuration(ANIM_TIME);
translateAnimation.setFillAfter(true);
return translateAnimation;
}
示例15: getTranslateAnimator
import android.view.animation.TranslateAnimation; //導入方法依賴的package包/類
private TranslateAnimation getTranslateAnimator(float targetX, float targetY) {
TranslateAnimation translateAnimation = new TranslateAnimation(1, 0.0f, 0, targetX, 1, 0.0f, 0, targetY);
translateAnimation.setDuration(ANIM_TIME);
translateAnimation.setFillAfter(true);
return translateAnimation;
}