本文整理了Java中android.view.ViewPropertyAnimator.x()
方法的一些代码示例,展示了ViewPropertyAnimator.x()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.x()
方法的具体详情如下:
包路径:android.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:x
暂无
代码示例来源:origin: commonsguy/cw-omnibus
@Override
public ViewPropertyAnimator x(float value) {
android.view.ViewPropertyAnimator n = mNative.get();
if (n != null) {
n.x(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 x(float value) {
android.view.ViewPropertyAnimator n = mNative.get();
if (n != null) {
n.x(value);
}
return this;
}
代码示例来源:origin: rubensousa/FloatingToolbar
public void hide() {
if (mMoveFabX) {
mToolbar.animate().x(mFab.getLeft() - mToolbar.getWidth() / 2f)
.setDuration(CIRCULAR_UNREVEAL_DURATION + mDelay)
.setStartDelay(TOOLBAR_UNREVEAL_DELAY + mDelay)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setListener(null);
}
if (mContentView != null) {
mContentView.animate().alpha(0f).scaleX(0.7f)
.setStartDelay(CIRCULAR_UNREVEAL_DELAY + mDelay)
.setDuration((MENU_ANIMATION_DURATION / 2) + mDelay)
.setListener(null);
}
}
代码示例来源: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: michael-rapp/ChromeLikeTabSwitcher
animation.setDuration(duration);
animation.setStartDelay(0);
animation.x(targetPosition);
animation.start();
代码示例来源:origin: rubensousa/FloatingToolbar
public void show() {
if (mMoveFabX) {
float fabEndX = mFab.getLeft() > mRootView.getWidth() / 2f ?
mFab.getLeft() - mFab.getWidth() : mFab.getLeft() + mFab.getWidth();
// Place view a bit closer to the fab
mToolbar.setX(fabEndX - mToolbar.getWidth() / 2f + mFab.getWidth());
// Move FloatingToolbar to the original position
mToolbar.animate().x(mToolbar.getLeft()).setStartDelay(CIRCULAR_REVEAL_DELAY + mDelay)
.setDuration((long) (CIRCULAR_REVEAL_DURATION) + mDelay)
.setInterpolator(new AccelerateDecelerateInterpolator());
}
// Start showing content view
if (mContentView != null) {
mContentView.setAlpha(0f);
mContentView.setScaleX(0.7f);
mContentView.animate().alpha(1).scaleX(1f)
.setDuration(MENU_ANIMATION_DURATION + mDelay)
.setStartDelay(MENU_ANIMATION_DELAY + mDelay)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mAnimationListener.onAnimationFinished();
mContentView.animate().setListener(null);
}
});
}
}
代码示例来源:origin: xiepeijie/SwipeCardView
.setDuration(animDuration)
.setInterpolator(new OvershootInterpolator(1.5f))
.x(objectX)
.y(objectY)
.rotation(0)
代码示例来源: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 x(float value) {
android.view.ViewPropertyAnimator n = mNative.get();
if (n != null) {
n.x(value);
}
return this;
}
代码示例来源:origin: kingargyle/adt-leanback-support
public static void x(View view, float value) {
view.animate().x(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: 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: 3llomi/RecordView
public void moveRecordButtonAndSlideToCancelBack(final RecordButton recordBtn, FrameLayout slideToCancelLayout, float initialX, float difX) {
final ValueAnimator positionAnimator =
ValueAnimator.ofFloat(recordBtn.getX(), initialX);
positionAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
positionAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float x = (Float) animation.getAnimatedValue();
recordBtn.setX(x);
}
});
recordBtn.stopScale();
positionAnimator.setDuration(0);
positionAnimator.start();
// if the move event was not called ,then the difX will still 0 and there is no need to move it back
if (difX != 0) {
float x = initialX - difX;
slideToCancelLayout.animate()
.x(x)
.setDuration(0)
.start();
}
}
代码示例来源:origin: graviton57/DynamicAnimationExample
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getActionMasked()){
case MotionEvent.ACTION_DOWN:
// capture the difference between view's top left corner and touch point
dX = v.getX() - event.getRawX();
dY = v.getY() - event.getRawY();
// cancel animations
xAnimation.cancel();
yAnimation.cancel();
break;
case MotionEvent.ACTION_MOVE:
// a different approach would be to change the view's LayoutParams.
animatedView.animate()
.x(event.getRawX() + dX)
.y(event.getRawY() + dY)
.setDuration(0)
.start();
break;
case MotionEvent.ACTION_UP:
xAnimation.start();
yAnimation.start();
break;
}
return true;
}
};
代码示例来源: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);
}
});
内容来源于网络,如有侵权,请联系作者删除!