Java Code Examples for android.view.animation.Animation#ABSOLUTE
The following examples show how to use
android.view.animation.Animation#ABSOLUTE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewUtils.java From Android-Application-ZJB with Apache License 2.0 | 6 votes |
public static void hideViewFromBottom(final View view) { if (view.getVisibility() == View.INVISIBLE) { return; } int height = view.getHeight(); TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, height); translateAnimation.setDuration(ANIMATION_DURATION); translateAnimation.setInterpolator(sAnimationInterpolator); translateAnimation.setAnimationListener(new AnimationAdapter() { @Override public void onAnimationEnd(Animation animation) { view.setVisibility(View.INVISIBLE); } }); view.startAnimation(translateAnimation); }
Example 2
Source File: DynamicRotationGuideView.java From AndroidStudyDemo with GNU General Public License v2.0 | 6 votes |
/** * 右边的动画 */ private void playRight() { //混合动画 AnimationSet animationSet = new AnimationSet(false); RotateAnimation rotateRight = new RotateAnimation(0, 359, Animation.ABSOLUTE, screenW/2-right.getLeft(), Animation.ABSOLUTE, (right.getBottom()-right.getTop())/2); RotateAnimation rotateSelf = new RotateAnimation(0, -359, Animation.RELATIVE_TO_SELF, 0.5f,Animation.RELATIVE_TO_SELF,0.5f); //播放时间 rotateSelf.setDuration(10*1000); //播放加速的模式 rotateSelf.setInterpolator(interpolator); //设置无限循环 rotateSelf.setRepeatCount(-1); rotateRight.setDuration(10*1000); rotateRight.setRepeatCount(-1); rotateRight.setInterpolator(interpolator); animationSet.addAnimation(rotateSelf); animationSet.addAnimation(rotateRight); //播放混合动画 right.startAnimation(animationSet); }
Example 3
Source File: MicrophoneRecorderView.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
void hide() { recordButtonFab.setTranslationX(0); recordButtonFab.setTranslationY(0); if (recordButtonFab.getVisibility() != VISIBLE) return; 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, lastOffsetX, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, lastOffsetY, Animation.ABSOLUTE, 0); scaleAnimation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); translateAnimation.setInterpolator(new DecelerateInterpolator()); animation.addAnimation(scaleAnimation); animation.addAnimation(translateAnimation); animation.setDuration(ANIMATION_DURATION); animation.setInterpolator(new AnticipateOvershootInterpolator(1.5f)); recordButtonFab.setVisibility(View.GONE); recordButtonFab.clearAnimation(); recordButtonFab.startAnimation(animation); }
Example 4
Source File: MicrophoneRecorderView.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
public void moveTo(float x) { this.lastPositionX = x; float offset = getOffset(x); Animation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, offset, Animation.ABSOLUTE, offset, Animation.RELATIVE_TO_SELF, -.25f, Animation.RELATIVE_TO_SELF, -.25f); translateAnimation.setDuration(0); translateAnimation.setFillAfter(true); translateAnimation.setFillBefore(true); recordButtonFab.startAnimation(translateAnimation); }
Example 5
Source File: ChannelAdapter.java From fingerpoetry-android with Apache License 2.0 | 5 votes |
/** * 获取位移动画 */ 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; }
Example 6
Source File: SlideInMenuPage.java From Paginize with MIT License | 5 votes |
@Override public boolean onPopPageAnimation(View oldPageView, View newPageView, AnimationDirection animationDirection) { TranslateAnimation anim = new TranslateAnimation( Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, 1); anim.setDuration(getAnimationDuration()); anim.setInterpolator(new DecelerateInterpolator(1.5f)); mMenuItemContainer.startAnimation(anim); mViewSemiTransparentBackground.animate().alpha(0).setDuration(getAnimationDuration()).start(); return true; }
Example 7
Source File: SpanVariableGridView.java From XMouse with MIT License | 5 votes |
protected final void translateChild(View v, Point prev, Point now) { TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y + prev.y, Animation.ABSOLUTE, 0); translate.setInterpolator(new AccelerateInterpolator(4f)); translate.setDuration(350); translate.setFillEnabled(false); translate.setFillAfter(false); v.clearAnimation(); v.startAnimation(translate); }
Example 8
Source File: SpanVariableGridView.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected final void translateChild(View v, Point prev, Point now) { TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y + prev.y, Animation.ABSOLUTE, 0); translate.setInterpolator(new AccelerateInterpolator(4f)); translate.setDuration(350); translate.setFillEnabled(false); translate.setFillAfter(false); v.clearAnimation(); v.startAnimation(translate); }
Example 9
Source File: DragDropGrid.java From android-draggable-viewpager with Apache License 2.0 | 5 votes |
private TranslateAnimation createTranslateAnimation(Point oldOffset, Point newOffset) { TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, oldOffset.x, Animation.ABSOLUTE, newOffset.x, Animation.ABSOLUTE, oldOffset.y, Animation.ABSOLUTE, newOffset.y); translate.setDuration(ANIMATION_DURATION); translate.setFillEnabled(true); translate.setFillAfter(true); translate.setInterpolator(new AccelerateDecelerateInterpolator()); return translate; }
Example 10
Source File: ChannelAdapter.java From NetEasyNews with GNU General Public License v3.0 | 5 votes |
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(360); translateAnimation.setFillAfter(true); return translateAnimation; }
Example 11
Source File: NewsChannelAdapter.java From Toutiao with Apache License 2.0 | 5 votes |
/** * 获取位移动画 */ 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; }
Example 12
Source File: InputPanel.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
public void moveTo(float x) { float offset = getOffset(x); Animation animation = new TranslateAnimation(Animation.ABSOLUTE, offset, Animation.ABSOLUTE, offset, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0); animation.setDuration(0); animation.setFillAfter(true); animation.setFillBefore(true); slideToCancelView.startAnimation(animation); }
Example 13
Source File: MicrophoneRecorderView.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
public void hide(float x) { this.lastPositionX = x; float offset = getOffset(x); 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, Animation.ABSOLUTE, 0, 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); }
Example 14
Source File: DynamicRotationGuideView.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
/** * 上面的动画 */ private void playTop() { RotateAnimation rotateAnimation = new RotateAnimation(0, 359, Animation.ABSOLUTE, screenW/2-top.getLeft(), Animation.ABSOLUTE, screenH/2-top.getTop()); rotateAnimation.setDuration(10*1000); rotateAnimation.setInterpolator(interpolator); rotateAnimation.setRepeatCount(-1); top.startAnimation(rotateAnimation); }
Example 15
Source File: DynamicRotationGuideView.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
/** * 下面的动画 */ private void playBottom() { RotateAnimation rotateBottom = new RotateAnimation(0, 359, Animation.RELATIVE_TO_SELF, 0.5f, Animation.ABSOLUTE,screenH/2-bottom.getTop()); rotateBottom.setDuration(10*1000); rotateBottom.setInterpolator(interpolator); rotateBottom.setRepeatCount(-1); bottom.startAnimation(rotateBottom); }
Example 16
Source File: DynamicRotationGuideView.java From AndroidStudyDemo with GNU General Public License v2.0 | 5 votes |
/** * 左边的动画 */ private void playLeft() { AnimationSet animationSet = new AnimationSet(false); RotateAnimation rotateLeft = new RotateAnimation(0, 359, Animation.ABSOLUTE, screenW/2-left.getLeft(), Animation.ABSOLUTE, (left.getBottom()-left.getTop())/2); rotateLeft.setDuration(10*1000); rotateLeft.setInterpolator(interpolator); rotateLeft.setRepeatCount(-1); RotateAnimation rotateSelf = new RotateAnimation(0, -359, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotateSelf.setDuration(10*1000); rotateSelf.setRepeatCount(-1); rotateSelf.setInterpolator(interpolator); animationSet.addAnimation(rotateSelf); animationSet.addAnimation(rotateLeft); left.startAnimation(animationSet); }
Example 17
Source File: ViewUtils.java From Android-Application-ZJB with Apache License 2.0 | 5 votes |
public static void showViewFromBottom(View view) { if (view.getVisibility() == View.VISIBLE) { return; } view.setVisibility(View.VISIBLE); int height = view.getHeight(); TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, height, Animation.ABSOLUTE, 0); translateAnimation.setDuration(ANIMATION_DURATION); translateAnimation.setInterpolator(sAnimationInterpolator); view.startAnimation(translateAnimation); }
Example 18
Source File: VoiceRecodingPanel.java From bcm-android with GNU General Public License v3.0 | 5 votes |
public void moveTo(float x) { float offset = getOffset(x); Animation animation = new TranslateAnimation(Animation.ABSOLUTE, offset, Animation.ABSOLUTE, offset, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0); animation.setDuration(0); animation.setFillAfter(true); animation.setFillBefore(true); slideToCancelView.startAnimation(animation); }
Example 19
Source File: SpanVariableGridView.java From UltimateAndroid with Apache License 2.0 | 5 votes |
protected final void translateChild(View v, Point prev, Point now) { TranslateAnimation translate = new TranslateAnimation(Animation.ABSOLUTE, -now.x + prev.x, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, -now.y + prev.y, Animation.ABSOLUTE, 0); translate.setInterpolator(new AccelerateInterpolator(4f)); translate.setDuration(350); translate.setFillEnabled(false); translate.setFillAfter(false); v.clearAnimation(); v.startAnimation(translate); }
Example 20
Source File: InputPanel.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
void moveTo(float offset) { Animation animation = new TranslateAnimation(Animation.ABSOLUTE, offset, Animation.ABSOLUTE, offset, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0); animation.setDuration(0); animation.setFillAfter(true); animation.setFillBefore(true); slideToCancelView.startAnimation(animation); }