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


Java ViewCompat.animate方法代码示例

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


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

示例1: show

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public T show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            textView.setScaleX(0);
            textView.setScaleY(0);
            textView.setVisibility(View.VISIBLE);
            ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
            animatorCompat.cancel();
            animatorCompat.setDuration(mAnimationDuration);
            animatorCompat.scaleX(1).scaleY(1);
            animatorCompat.setListener(null);
            animatorCompat.start();
        } else {
            textView.setScaleX(1);
            textView.setScaleY(1);
            textView.setVisibility(View.VISIBLE);
        }
    }
    return getSubInstance();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:BadgeItem.java

示例2: subscribeActual

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void subscribeActual(final CompletableObserver completableObserver) {
    verifyMainThread();
    final View view = viewWeakRef.get();
    if (view == null) {
        completableObserver.onComplete();
        return;
    }

    final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);

    completableObserver.onSubscribe(createAnimationDisposable(animator, onAnimationCancelAction));

    if (preTransformActions != null) {
        applyActions(preTransformActions, animator);
        animator.setDuration(NONE).setStartDelay(NONE)
                .withEndAction(() -> runAnimation(completableObserver, animator))
                .start();
    } else {
        runAnimation(completableObserver, animator);
    }
}
 
开发者ID:0ximDigital,项目名称:Rx2Animations,代码行数:23,代码来源:AnimateCompletable.java

示例3: createAnimatorToHeadView

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void createAnimatorToHeadView(final View v, final float angle)
{
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(200);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.rotationX(90);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(mChildView);
            mHeadLayout.setPivotX(mHeadLayout.getWidth() / 2);
            mHeadLayout.setPivotY(height);
        }
    });
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:17,代码来源:PerseiLayout.java

示例4: ensureOrCancelAnimator

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void ensureOrCancelAnimator(FloatingActionButton fab) {
    if (mFabTranslationYAnimator == null) {
        mFabTranslationYAnimator = ViewCompat.animate(fab);
        mFabTranslationYAnimator.setDuration(400);
        mFabTranslationYAnimator.setInterpolator(FAST_OUT_SLOW_IN_INTERPOLATOR);
    } else {
        mFabTranslationYAnimator.cancel();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:BottomNavBarFabBehaviour.java

示例5: animateOffset

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * Internal Method
 * <p>
 * used to set animation and
 * takes care of cancelling current animation
 * and sets duration and interpolator for animation
 *
 * @param offset translation offset that needs to set with animation
 */
private void animateOffset(final int offset) {
    if (mTranslationAnimator == null) {
        mTranslationAnimator = ViewCompat.animate(this);
        mTranslationAnimator.setDuration(mRippleAnimationDuration);
        mTranslationAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mTranslationAnimator.cancel();
    }
    mTranslationAnimator.translationY(offset).start();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:BottomNavigationBar.java

示例6: ensureOrCancelAnimator

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void ensureOrCancelAnimator(V child) {
    if (mOffsetValueAnimator == null) {
        mOffsetValueAnimator = ViewCompat.animate(child);
        mOffsetValueAnimator.setDuration(100);
        mOffsetValueAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mOffsetValueAnimator.cancel();
    }
}
 
开发者ID:appteam-nith,项目名称:Hillffair17,代码行数:10,代码来源:BottomSheetBehavior.java

示例7: show

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
 * @param animate whether to animate the change
 * @return this, to allow builder pattern
 */
public BadgeItem show(boolean animate) {
    mIsHidden = false;
    if (isWeakReferenceValid()) {
        TextView textView = mTextViewRef.get();
        if (animate) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                textView.setScaleX(0);
                textView.setScaleY(0);
            }
            textView.setVisibility(View.VISIBLE);
            ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
            animatorCompat.cancel();
            animatorCompat.setDuration(mAnimationDuration);
            animatorCompat.scaleX(1).scaleY(1);
            animatorCompat.setListener(null);
            animatorCompat.start();
        } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                textView.setScaleX(1);
                textView.setScaleY(1);
            }
            textView.setVisibility(View.VISIBLE);
        }
    }
    return this;
}
 
开发者ID:liu-xiao-dong,项目名称:JD-Test,代码行数:31,代码来源:BadgeItem.java

示例8: ensureOrCancelAnimator

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void ensureOrCancelAnimator(@NonNull  V child) {
    if (mOffsetValueAnimator == null) {
        mOffsetValueAnimator = ViewCompat.animate(child);
        mOffsetValueAnimator.setDuration(100);
        mOffsetValueAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mOffsetValueAnimator.cancel();
    }
}
 
开发者ID:homeii,项目名称:GxIconDIY,代码行数:10,代码来源:BottomNavigationBehavior.java

示例9: ensureOrCancelAnimator

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void ensureOrCancelAnimator(V child) {
    if (mTranslationAnimator == null) {
        mTranslationAnimator = ViewCompat.animate(child);
        mTranslationAnimator.setDuration(300);
        mTranslationAnimator.setInterpolator(INTERPOLATOR);
    } else {
        mTranslationAnimator.cancel();
    }
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:10,代码来源:BottomNavigationBehavior.java

示例10: createAnimatorTranslationY

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void createAnimatorTranslationY(final View v, final float h, final FrameLayout fl) {
    ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(v);
    viewPropertyAnimatorCompat.setDuration(200);
    viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
    viewPropertyAnimatorCompat.translationY(h);
    viewPropertyAnimatorCompat.start();
    viewPropertyAnimatorCompat.setUpdateListener(new ViewPropertyAnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(View view) {
            float height = ViewCompat.getTranslationY(v);
            fl.getLayoutParams().height = (int) height;
            fl.requestLayout();
        }
    });
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:16,代码来源:PerseiLayout.java

示例11: closeMenuing

import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void closeMenuing() {
    if (mChildView != null) {
        ViewPropertyAnimatorCompat viewPropertyAnimatorCompat = ViewCompat.animate(mChildView);
        viewPropertyAnimatorCompat.setDuration(200);
        viewPropertyAnimatorCompat.y(ViewCompat.getTranslationY(mChildView));
        viewPropertyAnimatorCompat.translationY(0);
        viewPropertyAnimatorCompat.setInterpolator(new DecelerateInterpolator());
        viewPropertyAnimatorCompat.start();
    }
    isOpenMenu = false;
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:12,代码来源:PerseiLayout.java


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