本文整理了Java中com.nineoldandroids.view.ViewPropertyAnimator.translationY()
方法的一些代码示例,展示了ViewPropertyAnimator.translationY()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.translationY()
方法的具体详情如下:
包路径:com.nineoldandroids.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:translationY
[英]This method will cause the View's translationY
property to be animated to the specified value. Animations already running on the property will be canceled.
[中]此方法将使视图的translationY
属性设置为指定值的动画。已在该属性上运行的动画将被取消。
代码示例来源:origin: navasmdc/MaterialDesignLibrary
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
switch (scrollState) {
case AbsListView.SCROLL_AXIS_NONE:
floatHiding = false;
floatShowing = false;
ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
break;
}
if (onScrollListener != null)
onScrollListener.onScrollStateChanged(absListView, scrollState);
}
代码示例来源:origin: navasmdc/MaterialDesignLibrary
@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (mLastFirstVisibleItem < firstVisibleItem) {
if (floatShowing) floatShowing = false;
if (!floatHiding) {
ViewPropertyAnimator.animate(view).translationY(500).setDuration(300);
floatHiding = true;
}
}
if (mLastFirstVisibleItem > firstVisibleItem) {
if (floatHiding) {
floatHiding = false;
}
if (!floatShowing) {
ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
floatShowing = true;
}
}
mLastFirstVisibleItem = firstVisibleItem;
if (onScrollListener != null)
onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
}
}
代码示例来源:origin: wangdan/AisenWeiBo
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: wangdan/AisenWeiBo
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: aa112901/remusic
private void showToolbar() {
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
if (headerTranslationY != 0) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start();
}
propagateToolbarState(true);
}
代码示例来源:origin: wangdan/AisenWeiBo
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
@Deprecated
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, fromY);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: wangdan/AisenWeiBo
ViewPropertyAnimator.animate(fabBtn).setInterpolator(mInterpolator)
.setDuration(TRANSLATE_DURATION_MILLIS)
.translationY(translationY);
} else {
ViewHelper.setTranslationY(fabBtn, translationY);
代码示例来源:origin: aa112901/remusic
private void hideToolbar() {
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
int toolbarHeight = mHeaderView.getHeight() - mActionBarSize - mStatusSize - tabLayout.getHeight();
if (headerTranslationY != -toolbarHeight) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start();
}
propagateToolbarState(false);
}
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
private void hideToolbar() {
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
int toolbarHeight = mToolbarView.getHeight();
if (headerTranslationY != -toolbarHeight) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(-toolbarHeight).setDuration(200).start();
}
propagateToolbarState(false);
}
代码示例来源:origin: ksoichiro/Android-ObservableScrollView
private void showToolbar() {
float headerTranslationY = ViewHelper.getTranslationY(mHeaderView);
if (headerTranslationY != 0) {
ViewPropertyAnimator.animate(mHeaderView).cancel();
ViewPropertyAnimator.animate(mHeaderView).translationY(0).setDuration(200).start();
}
propagateToolbarState(true);
}
代码示例来源:origin: code-mc/loadtoast
private void slideUp(int startDelay){
mReAttached = false;
ViewPropertyAnimator.animate(mView).setStartDelay(startDelay).alpha(0f)
.translationY(-mView.getHeight() + mTranslationY)
.setInterpolator(new AccelerateInterpolator())
.setDuration(300)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if(!mReAttached){
cleanup();
}
}
})
.start();
mVisible = false;
}
}
代码示例来源:origin: code-mc/loadtoast
private void showInternal(){
mView.show();
ViewHelper.setTranslationX(mView, (mParentView.getWidth() - mView.getWidth()) / 2);
ViewHelper.setAlpha(mView, 0f);
ViewHelper.setTranslationY(mView, -mView.getHeight() + mTranslationY);
//mView.setVisibility(View.VISIBLE);
ViewPropertyAnimator.animate(mView).alpha(1f).translationY(25 + mTranslationY)
.setInterpolator(new DecelerateInterpolator())
.setListener(null)
.setDuration(300).setStartDelay(0).start();
mVisible = true;
}
代码示例来源:origin: Leaking/WeGit
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
*/
public static void liftingFromBottom(View view, float baseRotation, int duration){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: Leaking/WeGit
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
public static void liftingFromBottom(View view, float baseRotation, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, view.getHeight() / 3);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: Leaking/WeGit
/**
* Lifting view
*
* @param view The animation target
* @param baseRotation initial Rotation X in 3D space
* @param fromY initial Y position of view
* @param duration aniamtion duration
* @param startDelay start delay before animation begin
*/
public static void liftingFromBottom(View view, float baseRotation, float fromY, int duration, int startDelay){
ViewHelper.setRotationX(view, baseRotation);
ViewHelper.setTranslationY(view, fromY);
ViewPropertyAnimator
.animate(view)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(duration)
.setStartDelay(startDelay)
.rotationX(0)
.translationY(0)
.start();
}
代码示例来源:origin: StannyBing/ZXUtils
.scaleY((float) thumbnailHeight / mViewPager.getHeight())
.translationX(thumbnailLeft)
.translationY(thumbnailTop)
.setListener(new Animator.AnimatorListener() {
@Override public void onAnimationStart(Animator animation) {
代码示例来源:origin: xiangzhihong/zhihu
ViewPropertyAnimator.animate(img_float_btn)
.setInterpolator(mInterpolator).setDuration(800)
.translationY(translationY);
} else {
ViewHelper.setTranslationY(img_float_btn, translationY);
代码示例来源:origin: HelloChenJinJun/TestChat
ViewPropertyAnimator.animate(this).setInterpolator(mInterpolator)
.setDuration(TRANSLATE_DURATION_MILLIS)
.translationY(translationY);
} else {
ViewHelper.setTranslationY(this, translationY);
代码示例来源:origin: Hankkin/TaoSchool
ViewPropertyAnimator.animate(this).setInterpolator(mInterpolator)
.setDuration(TRANSLATE_DURATION_MILLIS)
.translationY(translationY);
} else {
ViewHelper.setTranslationY(this, translationY);
代码示例来源:origin: StannyBing/ZXUtils
.scaleY(1)
.translationX(0)
.translationY(0)
.setInterpolator(new DecelerateInterpolator());
内容来源于网络,如有侵权,请联系作者删除!