本文整理了Java中android.view.ViewPropertyAnimator.translationZ()
方法的一些代码示例,展示了ViewPropertyAnimator.translationZ()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ViewPropertyAnimator.translationZ()
方法的具体详情如下:
包路径:android.view.ViewPropertyAnimator
类名称:ViewPropertyAnimator
方法名:translationZ
暂无
代码示例来源:origin: hitherejoe/animate
private void buildAndStartAnimation(View view) {
ViewPropertyAnimator animator = view.animate();
if (mAnimateAlphaCheck.isChecked() || view.getAlpha() == 0f) {
float animationValue = view.getAlpha() == 0f ? 1f : 0f;
animator.alpha(animationValue);
}
if (mAnimateScaleCheck.isChecked()) {
float animationValue = view.getScaleY() == 0f ? 1f : 0f;
animator.scaleX(animationValue).scaleY(animationValue);
}
if (mAnimateZCheck.isChecked()) {
float animationValue = view.getTranslationZ() != 25f ? 25f : 2f;
animator.translationZ(animationValue);
}
if (mAnimationDurationCheck.isChecked()) {
animator.setDuration(500l);
}
if (mAnimationDelayCheck.isChecked()) {
animator.setStartDelay(500l);
}
animator.setInterpolator(getSelectedInterpolator());
animator.start();
}
代码示例来源:origin: Doist/RecyclerViewExtensions
@Override
public void onDragStopped(final RecyclerView.ViewHolder holder) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.itemView.animate().translationZ(0f).setDuration(200L).setListener(new AnimatorListenerAdapter() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onAnimationEnd(Animator animation) {
holder.itemView.setTranslationZ(0f);
}
});
}
}
代码示例来源:origin: Doist/RecyclerViewExtensions
@Override
public void onDragStarted(final RecyclerView.ViewHolder holder) {
holder.itemView.setBackgroundColor(Color.WHITE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.itemView.animate().translationZ(8f).setDuration(200L).setListener(new AnimatorListenerAdapter() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onAnimationEnd(Animator animation) {
holder.itemView.setTranslationZ(8f);
}
});
}
}
代码示例来源:origin: googlesamples/android-ElevationDrag
@Override
public void onDragDrop(boolean captured) {
/* Animate the translation of the {@link View}. Note that the translation
is being modified, not the elevation. */
floatingShape.animate()
.translationZ(captured ? 50 : 0)
.setDuration(100);
Log.d(TAG, captured ? "Drag" : "Drop");
}
});
代码示例来源:origin: cdflynn/touchdemo
@Override
public void onTouchEvent(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
v.animate().translationZ(Z_MIN)
.setDuration(DURATION_MS)
.start();
return;
case MotionEvent.ACTION_DOWN:
v.animate().translationZ(Z_MAX)
.setDuration(DURATION_MS)
.start();
return;
default:
return;
}
}
}
代码示例来源:origin: hencoder/PracticeDraw6
case 4:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
imageView.animate().translationZ(Utils.dpToPixel(15));
imageView.animate().translationZ(0);
内容来源于网络,如有侵权,请联系作者删除!