当前位置: 首页>>代码示例>>Java>>正文


Java AnimationSet.setFillBefore方法代码示例

本文整理汇总了Java中android.view.animation.AnimationSet.setFillBefore方法的典型用法代码示例。如果您正苦于以下问题:Java AnimationSet.setFillBefore方法的具体用法?Java AnimationSet.setFillBefore怎么用?Java AnimationSet.setFillBefore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.animation.AnimationSet的用法示例。


在下文中一共展示了AnimationSet.setFillBefore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setAdapterInsertAnimation

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public static void setAdapterInsertAnimation(final View aCard, int row, int height) {
	final int ANIMATION_DURATION = 650;
	final int BASE_DELAY = 50;

	TranslateAnimation translationAnimation = new TranslateAnimation(0,0, height,0);

	AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);

	final AnimationSet animationSet = new AnimationSet(true);
	animationSet.addAnimation(translationAnimation);
	animationSet.addAnimation(alphaAnimation);
	animationSet.setInterpolator(new AccelerateDecelerateInterpolator());
	animationSet.setFillAfter(true);
	animationSet.setFillBefore(true);
	animationSet.setDuration(ANIMATION_DURATION + row * BASE_DELAY);

	aCard.setAnimation(animationSet);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:19,代码来源:AnimationService.java

示例2: display

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void display(float x) {
  this.startPositionX = x;
  this.lastPositionX  = x;

  recordButtonFab.setVisibility(View.VISIBLE);

  float translation = ViewCompat.getLayoutDirection(recordButtonFab) ==
      ViewCompat.LAYOUT_DIRECTION_LTR ? -.25f : .25f;

  AnimationSet animation = new AnimationSet(true);
  animation.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, translation,
                                                Animation.RELATIVE_TO_SELF, -.25f,
                                                Animation.RELATIVE_TO_SELF, -.25f));

  animation.addAnimation(new ScaleAnimation(.5f, 1f, .5f, 1f,
                                            Animation.RELATIVE_TO_SELF, .5f,
                                            Animation.RELATIVE_TO_SELF, .5f));

  animation.setFillBefore(true);
  animation.setFillAfter(true);
  animation.setDuration(ANIMATION_DURATION);
  animation.setInterpolator(new OvershootInterpolator());

  recordButtonFab.startAnimation(animation);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:27,代码来源:MicrophoneRecorderView.java

示例3: hide

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
public void hide(float x) {
  this.lastPositionX = x;

  float offset          = getOffset(x);
  int   widthAdjustment = getWidthAdjustment();

  AnimationSet animation = new AnimationSet(false);
  Animation scaleAnimation = new ScaleAnimation(1, 0.5f, 1, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f,
                                                Animation.RELATIVE_TO_SELF, 0.5f);

  Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset + widthAdjustment,
                                                        Animation.ABSOLUTE, widthAdjustment,
                                                        Animation.RELATIVE_TO_SELF, -.25f,
                                                        Animation.RELATIVE_TO_SELF, -.25f);

  scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));
  translateAnimation.setInterpolator(new DecelerateInterpolator());
  animation.addAnimation(scaleAnimation);
  animation.addAnimation(translateAnimation);
  animation.setDuration(ANIMATION_DURATION);
  animation.setFillBefore(true);
  animation.setFillAfter(false);
  animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f));

  recordButtonFab.setVisibility(View.GONE);
  recordButtonFab.clearAnimation();
  recordButtonFab.startAnimation(animation);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:30,代码来源:MicrophoneRecorderView.java

示例4: clear

import android.view.animation.AnimationSet; //导入方法依赖的package包/类
/**
 * Hides every currently shown element in the recyclerview. When the last view has been hidden
 * clearNoAnimation() is called
 * @return The time is takes for the last element to hide
 */
public int clear() {
	final int ANIMATION_DURATION = 300;
	final int BASE_DELAY = 50;

	int startPosition = mRecyclerView.getManager().findFirstVisibleItemPosition();
	int endPosition = mRecyclerView.getManager().findLastVisibleItemPosition();

	int timeBeforeLastAnimIsDone = ANIMATION_DURATION;
	for(int i = startPosition; i <= endPosition; i++) {
		int delay = (i - startPosition) * BASE_DELAY;
		final int finalI = i;

		final int TRANSLATE_LENGTH = context.getResources().getDisplayMetrics().heightPixels;
		Animation mTranslateAnim = new TranslateAnimation(0, 0, 0, TRANSLATE_LENGTH);
		Animation mAlphaAnim = new AlphaAnimation(1f, 0f);

		final AnimationSet mAnimSet = new AnimationSet(true);
		mAnimSet.addAnimation(mTranslateAnim);
		mAnimSet.addAnimation(mAlphaAnim);
		mAnimSet.setDuration(ANIMATION_DURATION);
		mAnimSet.setInterpolator(new AccelerateDecelerateInterpolator());
		mAnimSet.setFillAfter(true);
		mAnimSet.setFillBefore(true);

		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				View v = mRecyclerView.getManager().getChildAt(finalI);
				if(v != null) {
					v.startAnimation(mAnimSet);
				}
			}
		}, delay);

		if(i == endPosition) {
			timeBeforeLastAnimIsDone = ANIMATION_DURATION + delay;
		}
	}

	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			clearNoAnimation();
		}
	}, timeBeforeLastAnimIsDone);

	return timeBeforeLastAnimIsDone;
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:54,代码来源:MainActivityAdapter.java


注:本文中的android.view.animation.AnimationSet.setFillBefore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。