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