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

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

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

ViewPropertyAnimator.y介绍

暂无

代码示例

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

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

代码示例来源:origin: seven332/EhViewer

int fabEndX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2);
int fabEndY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2);
mFab.animate().x(fabEndX).y(fabEndY).scaleX(0.0f).scaleY(0.0f)
    .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR)
    .setDuration(300L).setListener(new SimpleAnimatorListener() {

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

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

代码示例来源:origin: GeekGhost/Ghost

/**
 * Positions the children at the "correct" positions
 */
private void positionItem(int index) {
  View child = getChildAt(index);
  int width = child.getMeasuredWidth();
  int height = child.getMeasuredHeight();
  int left = (getWidth() - width) / 2;
  child.layout(left, paddingTop, left + width, paddingTop + height);
  //layout each child slightly above the previous child (we start with the bottom)
  int childCount = getChildCount();
  float offset = (int) (((childCount - 1) * CARD_SPACING) - (index * CARD_SPACING));
  //child.setY(paddingTop + offset);
  child.animate()
      .setDuration(restoreInstanceState ? 0 : 160)
      .y(paddingTop + offset);
  restoreInstanceState = false;
}

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

private void flingQuestMarkerTo(View quest, View target, Runnable onFinished)
{
  int[] targetPos = new int[2];
  target.getLocationOnScreen(targetPos);
  quest.animate()
    .scaleX(1.6f).scaleY(1.6f)
    .setInterpolator(new OvershootInterpolator(8f))
    .setDuration(250)
    .withEndAction(() -> {
      quest.animate()
        .scaleX(0.2f).scaleY(0.2f)
        .alpha(0.8f)
        .x(targetPos[0]).y(targetPos[1])
        .setDuration(250)
        .setInterpolator(new AccelerateInterpolator())
        .withEndAction(onFinished);
  });
}

代码示例来源:origin: michaldrabik/TapBarMenu

/**
 * Close the menu.
 */
public void close() {
 updateDimensions(width, height);
 state = State.CLOSED;
 showIcons(false);
 animator[LEFT].setFloatValues(0, button[LEFT]);
 animator[RIGHT].setFloatValues(width, button[RIGHT]);
 animator[RADIUS].setFloatValues(0, button[RADIUS]);
 animator[TOP].setFloatValues(0, button[TOP]);
 animator[BOTTOM].setFloatValues(height, button[BOTTOM]);
 animatorSet.cancel();
 animatorSet.start();
 if (iconClosedDrawable instanceof Animatable) {
  ((Animatable) iconClosedDrawable).start();
 }
 this.animate()
     .y(yPosition)
     .setDuration(animationDuration)
     .setInterpolator(DECELERATE_INTERPOLATOR)
     .start();
}

代码示例来源:origin: michaldrabik/TapBarMenu

/**
 * Open the menu.
 */
public void open() {
 state = State.OPENED;
 showIcons(true);
 animator[LEFT].setFloatValues(button[LEFT], 0);
 animator[RIGHT].setFloatValues(button[RIGHT], width);
 animator[RADIUS].setFloatValues(button[RADIUS], 0);
 animator[TOP].setFloatValues(button[TOP], 0);
 animator[BOTTOM].setFloatValues(button[BOTTOM], height);
 animatorSet.cancel();
 animatorSet.start();
 if (iconOpenedDrawable instanceof Animatable) {
  ((Animatable) iconOpenedDrawable).start();
 }
 ViewGroup parentView = (ViewGroup) TapBarMenu.this.getParent();
 this.animate()
   .y(menuAnchor == MENU_ANCHOR_BOTTOM ? parentView.getBottom() - height : 0)
     .setDuration(animationDuration)
     .setInterpolator(DECELERATE_INTERPOLATOR)
     .start();
}

代码示例来源:origin: xiepeijie/SwipeCardView

.setInterpolator(new OvershootInterpolator(1.5f))
.x(objectX)
.y(objectY)
.rotation(0)
.start();

代码示例来源:origin: michael-rapp/ChromeLikeTabSwitcher

@Override
public final void animatePosition(@NonNull final Axis axis,
                 @NonNull final ViewPropertyAnimator animator,
                 @NonNull final AbstractItem item, final float position,
                 final boolean includePadding) {
  Condition.INSTANCE.ensureNotNull(axis, "The axis may not be null");
  Condition.INSTANCE.ensureNotNull(animator, "The animator may not be null");
  Condition.INSTANCE.ensureNotNull(item, "The item may not be null");
  if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
    Toolbar[] toolbars = getTabSwitcher().getToolbars();
    animator.y((getTabSwitcher().areToolbarsShown() && getTabSwitcher().isSwitcherShown() &&
        toolbars != null ?
        toolbars[TabSwitcher.PRIMARY_TOOLBAR_INDEX].getHeight() - tabInset : 0) +
        (includePadding ? getTabSwitcherPadding(axis, Gravity.START) : 0) + position);
  } else {
    View view = item.getView();
    FrameLayout.LayoutParams layoutParams =
        (FrameLayout.LayoutParams) view.getLayoutParams();
    animator.x(position + layoutParams.leftMargin + (includePadding ?
        getTabSwitcher().getPaddingLeft() / 2f -
            getTabSwitcher().getPaddingRight() / 2f : 0) -
        (getTabSwitcher().getLayout() == Layout.PHONE_LANDSCAPE &&
            getTabSwitcher().isSwitcherShown() ?
            stackedTabCount * stackedTabSpacing / 2f : 0));
  }
}

代码示例来源:origin: Android500/AwesomeDrawer

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

代码示例来源:origin: kingargyle/adt-leanback-support

public static void y(View view, float value) {
  view.animate().y(value);
}

代码示例来源:origin: rallat/smokeAndMirrors

@Override
  public void onClick(@NonNull View v) {
    assert view != null;
    view.animate().x(width).y(height).setDuration(2000).withEndAction(new Runnable() {
      @Override
      public void run() {
        view.setX(0);
        view.setY(0);
      }
    }).start();
  }
});

代码示例来源:origin: rallat/smokeAndMirrors

@Override
  public void onClick(@NonNull View v) {
    assert view != null;
    view.animate().x(width).y(height).setDuration(2000).withEndAction(new Runnable() {
      @Override
      public void run() {
        view.setX(0);
        view.setY(0);
      }
    }).start();
  }
});

代码示例来源:origin: maxyou/CalendarPicker

private void closeFragment() {
  calendar_time_chooser_layout.animate().y(getActivity().findViewById(android.R.id.content).getHeight()).setDuration(300).withEndAction(new Runnable() {
    @Override
    public void run() {
      calendar_time_chooser_viewpager.closeFragment();
      getActivity().getFragmentManager().beginTransaction().remove(FragmentCalendarPicker.this).commit();
    }
  });
}

代码示例来源:origin: livroandroid/5ed

public void onClickAnimarAPI(View view) {
    ImageView img = (ImageView) findViewById(R.id.img);
    img.animate().x(200).y(200).alpha(0).setDuration(1000).start();

    Toast.makeText(this, "img.animate().x(400).y(400).alpha(0)", Toast.LENGTH_SHORT).show();
  }
}

代码示例来源:origin: livroandroid/5ed

@Override
  public void onClick(View v) {
    // Simular login aqui... Se login ok, aplicar a animaçãoo e trocar de tela
    final ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
    layout.animate().x(1).y(2).alpha(0);
    ValueAnimator anim = ObjectAnimator.ofFloat(layout, "alpha", 1f, 0f);
    anim.setDuration(2000);
    anim.addListener(new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {
        finish();
      }
    });
    anim.start();
  }
}

代码示例来源:origin: li2/learning-android-open-source

@Override
  public void onClick(View v) {
    animatingButton.animate().x(0).y(0);
  }
});

代码示例来源:origin: nglauber/dominando_android2

@Override
  public void movimentar() {
    float novoX = (float) (Math.random() * (mFrame.getWidth() - mImg.getWidth()));
    float novoY = (float) (Math.random() * (mFrame.getHeight() - mImg.getHeight()));
    getAnimator().x(novoX).y(novoY);
  }
}

代码示例来源:origin: rallat/smokeAndMirrors

@Override
  public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
      int oldRight,
      int oldBottom) {
    saturn.removeOnLayoutChangeListener(this);
    profile.bringToFront();
    profile.animate().y(saturn.getMeasuredHeight()*2).setStartDelay(200).setDuration(2000).withEndAction(new Runnable() {
      @Override
      public void run() {
        saturn.bringToFront();
        saturn.animate().y(profile.getMeasuredHeight() * 3).setStartDelay(200).setDuration(2000);
      }
    });
  }
});

代码示例来源:origin: li2/learning-android-open-source

@Override
  public void onClick(View v) {
    int xValue = container.getWidth() - animatingButton.getWidth();
    int yValue = container.getHeight() - animatingButton.getHeight();
    animatingButton.animate().x(xValue).y(yValue);
  }
});

相关文章