本文整理汇总了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;
}