android.view.ViewPropertyAnimator.translationX()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中android.view.ViewPropertyAnimator.translationX()方法的一些代码示例,展示了ViewPropertyAnimator.translationX()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.translationX()方法的具体详情如下:
包路径:android.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:translationX

ViewPropertyAnimator.translationX介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public ViewPropertyAnimator translationX(float value) {
  android.view.ViewPropertyAnimator n = mNative.get();
  if (n != null) {
    n.translationX(value);
  }
  return this;
}

代码示例来源:origin: k9mail/k-9

public void showCryptoStatus(CryptoStatusDisplayType cryptoStatusDisplayType) {
  boolean shouldBeHidden = cryptoStatusDisplayType.childIdToDisplay == VIEW_INDEX_HIDDEN;
  if (shouldBeHidden) {
    cryptoStatusView.animate()
        .translationXBy(100.0f)
        .alpha(0.0f)
        .setDuration(CRYPTO_ICON_OUT_DURATION)
        .setInterpolator(CRYPTO_ICON_OUT_ANIMATOR)
        .start();
    return;
  }
  cryptoStatusView.setVisibility(View.VISIBLE);
  cryptoStatusView.setDisplayedChildId(cryptoStatusDisplayType.childIdToDisplay);
  cryptoStatusView.animate()
      .translationX(0.0f)
      .alpha(1.0f)
      .setDuration(CRYPTO_ICON_IN_DURATION)
      .setInterpolator(CRYPTO_ICON_IN_ANIMATOR)
      .start();
}

代码示例来源:origin: janishar/PlaceHolderView

protected static <V extends View>void itemAnimFromXDesc(V view, float xInit, float xFinal, float factor, int duration){
  view.setTranslationX(xInit);
  view.animate()
      .translationX(xFinal)
      .setInterpolator(new DecelerateInterpolator(factor))
      .setDuration(duration)
      .start();
}

代码示例来源:origin: janishar/PlaceHolderView

protected static <V extends View>void itemAnimFromXAsc(V view, float xInit, float xFinal, float factor, int duration){
  view.setTranslationX(xInit);
  view.animate()
      .translationX(xFinal)
      .setInterpolator(new AccelerateInterpolator(factor))
      .setDuration(duration)
      .start();
}

代码示例来源:origin: mcxtzhang/ZLayoutManager

public void rollBack(RecyclerView.ViewHolder viewHolder) {
  View ViewLast1 = mRv.getChildAt(viewHolder.getLayoutPosition() - 1);
  ViewLast1.animate().translationX(0).setDuration(100).start();
  View ViewLast2 = mRv.getChildAt(viewHolder.getLayoutPosition() - 2);
  ViewLast2.animate().translationX(0).setDuration(100).start();
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void showSearchOnStart() {
  if (DEBUG) Log.d(TAG, "showSearchOnStart() called, searchQuery → "
      + searchString
      + ", lastSearchedQuery → "
      + lastSearchedString);
  searchEditText.setText(searchString);
  if (TextUtils.isEmpty(searchString) || TextUtils.isEmpty(searchEditText.getText())) {
    searchToolbarContainer.setTranslationX(100);
    searchToolbarContainer.setAlpha(0f);
    searchToolbarContainer.setVisibility(View.VISIBLE);
    searchToolbarContainer.animate()
        .translationX(0)
        .alpha(1f)
        .setDuration(200)
        .setInterpolator(new DecelerateInterpolator()).start();
  } else {
    searchToolbarContainer.setTranslationX(0);
    searchToolbarContainer.setAlpha(1f);
    searchToolbarContainer.setVisibility(View.VISIBLE);
  }
}

代码示例来源:origin: prolificinteractive/material-calendarview

@Override
 public void onAnimationEnd(Animator animator) {
  title.setText(newTitle);
  doTranslation(title, translation);
  final ViewPropertyAnimator viewPropertyAnimator = title.animate();
  if (orientation == MaterialCalendarView.HORIZONTAL) {
   viewPropertyAnimator.translationX(0);
  } else {
   viewPropertyAnimator.translationY(0);
  }
  viewPropertyAnimator
    .alpha(1)
    .setDuration(animDuration)
    .setInterpolator(interpolator)
    .setListener(new AnimatorListener())
    .start();
 }
}).start();

代码示例来源:origin: nickbutcher/plaid

holder.itemView.animate()
    .alpha(1f)
    .translationX(0f)
    .translationY(0f)
    .setDuration(getAddDuration())

代码示例来源:origin: wangdan/AisenWeiBo

private void setTranslation(float translationX, float translationY) {
  animate().setInterpolator(getInterpolator()).setDuration(FAB_ANIM_DURATION)
      .translationX(translationX).translationY(translationY);
}

代码示例来源:origin: xinghongfei/LookLook

holder.itemView.animate()
    .alpha(1f)
    .translationX(0f)
    .translationY(0f)
    .setDuration(getAddDuration())

代码示例来源:origin: janishar/PlaceHolderView

@Override
public void onAnimationEnd(Animator animation) {
  if(mSwipeOption.getIsPutBackActive()){
    mLayoutView.animate()
        .translationX(mTransXToRestore)
        .translationY(mTransYToRestore)
        .setInterpolator(new AccelerateInterpolator(mSwipeDecor.getSwipeAnimFactor()))
        .setDuration((long)(mSwipeDecor.getSwipeAnimTime()))
        .setListener(mViewPutBackAnimatorListener)
        .start();
  }else if(mCallback != null){
    mCallback.onRemoveView(SwipeViewBinder.this);
  }
}

代码示例来源:origin: prolificinteractive/material-calendarview

viewPropertyAnimator.translationX(translation * -1);
} else {
 viewPropertyAnimator.translationY(translation * -1);

代码示例来源:origin: janishar/PlaceHolderView

.translationX(transX)
.translationY(transY)
.setInterpolator(new AccelerateInterpolator(mSwipeDecor.getSwipeAnimFactor()))

代码示例来源:origin: janishar/PlaceHolderView

.translationX(transX)
.setInterpolator(new AccelerateInterpolator(mSwipeDecor.getSwipeAnimFactor()))
.setDuration((long)(mSwipeDecor.getSwipeAnimTime() * 1.25))

代码示例来源:origin: janishar/PlaceHolderView

animator.rotation(mSwipeDecor.getSwipeRotationAngle());
  animator.translationX(transX).translationY(transY);
  break;
case SwipePlaceHolderView.SWIPE_TYPE_HORIZONTAL:
    transX = -mLayoutView.getWidth();
  animator.translationX(transX);
  break;
case SwipePlaceHolderView.SWIPE_TYPE_VERTICAL:

代码示例来源:origin: com.nineoldandroids/library

@Override
public ViewPropertyAnimator translationX(float value) {
  android.view.ViewPropertyAnimator n = mNative.get();
  if (n != null) {
    n.translationX(value);
  }
  return this;
}

代码示例来源:origin: k0shk0sh/PermissionHelper

private void setTranslationX(View view, float value) {
  view.animate().translationX(value);
}

代码示例来源:origin: janishar/PlaceHolderView

.translationX(transX)
.translationY(transY)
.setInterpolator(new AccelerateInterpolator(getSwipeDecor().getSwipeAnimFactor()))

代码示例来源:origin: westnordost/StreetComplete

private void animateAll(ViewGroup parent, int dir, boolean in, int minDuration, int maxDuration)
{
  int childCount = parent.getChildCount();
  int w = parent.getWidth();
  for(int i = 0; i < childCount; ++i)
  {
    View v = parent.getChildAt(i);
    int duration = minDuration + (maxDuration - minDuration) / Math.max(1, childCount-1) *
      (in ? childCount-1-i : i );
    ViewPropertyAnimator animator = v.animate().translationX(w*dir);
    animator.setDuration(duration);
    animator.setInterpolator(dir != 0 ? new AccelerateInterpolator() : new DecelerateInterpolator());
  }
}

代码示例来源:origin: takahirom/PreLollipopTransition

private static void runEnterAnimation(MoveData moveData, TimeInterpolator interpolator, Animator.AnimatorListener listener) {
  final View toView = moveData.toView;
  toView.setPivotX(0);
  toView.setPivotY(0);
  toView.setScaleX(moveData.widthScale);
  toView.setScaleY(moveData.heightScale);
  toView.setTranslationX(moveData.leftDelta);
  toView.setTranslationY(moveData.topDelta);
  toView.animate()
      .setDuration(moveData.duration)
      .scaleX(1)
      .scaleY(1)
      .translationX(0)
      .translationY(0)
      .setListener(listener)
      .setInterpolator(interpolator);
}

相关文章