本文整理了Java中com.nineoldandroids.view.ViewPropertyAnimator.xBy()
方法的一些代码示例,展示了ViewPropertyAnimator.xBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.xBy()
方法的具体详情如下:
包路径:com.nineoldandroids.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:xBy
[英]This method will cause the View's x
property to be animated by the specified value. Animations already running on the property will be canceled.
[中]此方法将使视图的x
属性按指定值设置动画。已在该属性上运行的动画将被取消。
代码示例来源:origin: livroandroid/5ed
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,float velocityY) {
// Usuário fez um gesto de swipe lateral
try {
if (e1.getX() - e2.getX() > swipeMinDistance && Math.abs(velocityX) >
swipeThreasholdVelocity) {
// Fez um gesto da direita para a esquerda
text.setText("<<< Left");
animate(img).xBy(-100);
} else if (e2.getX() - e1.getX() > swipeMinDistance && Math.abs(velocityX) >
swipeThreasholdVelocity) {
// Fez um gesto da esquerda para a direita
text.setText("Right >>>");
animate(img).xBy(100);
}
} catch (Exception e) { }
return false;
}
}
代码示例来源:origin: livroandroid/5ed
public void onClickAnimar(View view) {
animate(img).xBy(200).yBy(200).rotation(180).alpha(0.5F).setDuration(2000);
}
}
内容来源于网络,如有侵权,请联系作者删除!