下面列出了android.view.View#getTranslationZ ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private float getValue(int propertyConstant) {
final View node = mView;
switch (propertyConstant) {
case ViewPropertyAnimatorConstant.TRANSLATION_X:
return node.getTranslationX();
case ViewPropertyAnimatorConstant.TRANSLATION_Y:
return node.getTranslationY();
case ViewPropertyAnimatorConstant.TRANSLATION_Z:
return node.getTranslationZ();
case ViewPropertyAnimatorConstant.ROTATION:
return node.getRotation();
case ViewPropertyAnimatorConstant.ROTATION_X:
return node.getRotationX();
case ViewPropertyAnimatorConstant.ROTATION_Y:
return node.getRotationY();
case ViewPropertyAnimatorConstant.SCALE_X:
return node.getScaleX();
case ViewPropertyAnimatorConstant.SCALE_Y:
return node.getScaleY();
case ViewPropertyAnimatorConstant.X:
return mView.getLeft() + node.getTranslationX();
case ViewPropertyAnimatorConstant.Y:
return mView.getTop() + node.getTranslationY();
case ViewPropertyAnimatorConstant.Z:
return node.getElevation() + node.getTranslationZ();
case ViewPropertyAnimatorConstant.ALPHA:
return mView.getAlpha();
}
return 0;
}
public Transforms(View view) {
translationX = view.getTranslationX();
translationY = view.getTranslationY();
translationZ = view.getTranslationZ();
scaleX = view.getScaleX();
scaleY = view.getScaleY();
rotationX = view.getRotationX();
rotationY = view.getRotationY();
rotationZ = view.getRotation();
}
private static SharedElementOriginalState getOldSharedElementState(View view, String name,
Bundle transitionArgs) {
SharedElementOriginalState state = new SharedElementOriginalState();
state.mLeft = view.getLeft();
state.mTop = view.getTop();
state.mRight = view.getRight();
state.mBottom = view.getBottom();
state.mMeasuredWidth = view.getMeasuredWidth();
state.mMeasuredHeight = view.getMeasuredHeight();
state.mTranslationZ = view.getTranslationZ();
state.mElevation = view.getElevation();
if (!(view instanceof ImageView)) {
return state;
}
Bundle bundle = transitionArgs.getBundle(name);
if (bundle == null) {
return state;
}
int scaleTypeInt = bundle.getInt(KEY_SCALE_TYPE, -1);
if (scaleTypeInt < 0) {
return state;
}
ImageView imageView = (ImageView) view;
state.mScaleType = imageView.getScaleType();
if (state.mScaleType == ImageView.ScaleType.MATRIX) {
state.mMatrix = new Matrix(imageView.getImageMatrix());
}
return state;
}
@Override
public float getValue(View view) {
if (isZSupported()) {
return view.getTranslationZ();
} else {
return 0;
}
}
public static float getTranslationZ(View view) {
return view.getTranslationZ();
}
public static float getTranslationZ(View view) {
return view.getTranslationZ();
}
@Override
public float getTranslationZ(@NonNull View view) {
return view.getTranslationZ();
}