本文整理了Java中android.view.View.setTranslationZ()
方法的一些代码示例,展示了View.setTranslationZ()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。View.setTranslationZ()
方法的具体详情如下:
包路径:android.view.View
类名称:View
方法名:setTranslationZ
暂无
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
public void setTranslationZ(@NonNull View view, float z) {
view.setTranslationZ(z);
}
}
代码示例来源:origin: ZieIony/Carbon
public void setTranslationZ(float translationZ) {
if (translationZ == this.translationZ)
return;
if (Carbon.IS_PIE_OR_HIGHER) {
super.setTranslationZ(translationZ);
} else if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
if ((ambientShadowColor == null || spotShadowColor == null) && renderingMode == RenderingMode.Auto) {
super.setTranslationZ(translationZ);
} else {
super.setTranslationZ(0);
}
} else if (translationZ != this.translationZ && getParent() != null) {
((android.view.View) getParent()).postInvalidate();
}
this.translationZ = translationZ;
}
代码示例来源:origin: bluelinelabs/Conductor
@Override
public void onAnimationEnd(Animator animation) {
// Clean up
view.getOverlay().clear();
if (!fromFab) {
view.setTranslationX(0);
view.setTranslationY(0);
view.setTranslationZ(0);
view.measure(
makeMeasureSpec(endBounds.width(), View.MeasureSpec.EXACTLY),
makeMeasureSpec(endBounds.height(), View.MeasureSpec.EXACTLY));
view.layout(endBounds.left, endBounds.top, endBounds.right, endBounds.bottom);
}
}
});
代码示例来源:origin: ZieIony/Carbon
@Override
public void setElevation(float elevation) {
if (Carbon.IS_PIE_OR_HIGHER) {
super.setElevation(elevation);
super.setTranslationZ(translationZ);
} else if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
if ((ambientShadowColor == null || spotShadowColor == null) && renderingMode == RenderingMode.Auto) {
super.setElevation(elevation);
super.setTranslationZ(translationZ);
} else {
super.setElevation(0);
super.setTranslationZ(0);
}
} else if (elevation != this.elevation && getParent() != null) {
((android.view.View) getParent()).postInvalidate();
}
this.elevation = elevation;
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = LOLLIPOP)
public void translationZ() {
view.setTranslationZ(10f);
assertThat(view.getTranslationZ()).isEqualTo(10f);
}
代码示例来源:origin: GeekGhost/Ghost
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setZTranslations() {
//this is only needed to add shadows to cardviews on > lollipop
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int count = getChildCount();
for (int i = 0; i < count; ++i) {
getChildAt(i).setTranslationZ(i * 10);
}
}
}
代码示例来源:origin: AriesHoo/FastLib
@Override
public void onItemClear() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
itemView.setTranslationZ(0);
}
}
代码示例来源:origin: AriesHoo/FastLib
@Override
public void onItemSelectedChanged() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
itemView.setTranslationZ(30);
}
}
代码示例来源:origin: Doist/RecyclerViewExtensions
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onAnimationEnd(Animator animation) {
holder.itemView.setTranslationZ(8f);
}
});
代码示例来源:origin: Doist/RecyclerViewExtensions
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onAnimationEnd(Animator animation) {
holder.itemView.setTranslationZ(0f);
}
});
代码示例来源:origin: geniusgithub/AndroidDialer
/**
* Configures the floating action button, clipping it to a circle and setting its translation z.
* @param view The float action button's view.
* @param res The resources file.
*/
public static void setupFloatingActionButton(View view, Resources res) {
view.setOutlineProvider(OVAL_OUTLINE_PROVIDER);
view.setTranslationZ(
res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z));
}
代码示例来源:origin: geniusgithub/AndroidDialer
/**
* Configures the floating action button, clipping it to a circle and setting its translation z.
* @param view The float action button's view.
* @param res The resources file.
*/
public static void setupFloatingActionButton(View view, Resources res) {
if (CompatUtils.isLollipopCompatible()) {
view.setOutlineProvider(OVAL_OUTLINE_PROVIDER);
view.setTranslationZ(
res.getDimensionPixelSize(R.dimen.floating_action_button_translation_z));
}
}
代码示例来源:origin: fookwood/Launcher3
public void onAnimationStart(Animator animation) {
revealView.setOutlineProvider(outlineProvider);
revealView.setClipToOutline(true);
revealView.setTranslationZ(-elevation);
}
代码示例来源:origin: fookwood/Launcher3
public void onAnimationEnd(Animator animation) {
revealView.setOutlineProvider(originalProvider);
revealView.setClipToOutline(false);
revealView.setTranslationZ(0);
}
代码示例来源:origin: Omega-R/OmegaRecyclerView
private void reset(ViewPropertyAnimator animator, OmegaExpandableRecyclerView.Adapter.ChildViewHolder holder) {
animator.setUpdateListener(null);
animator.setStartDelay(0);
holder.itemView.setTranslationZ(ExpandableLayoutManager.DEFAULT_CHILD_Z);
holder.contentView.setTranslationY(0f);
((ChildClippingFrameLayout) holder.itemView).invalidateClipping();
}
代码示例来源:origin: klinker24/launcher3
public void onAnimationStart(Animator animation) {
revealView.setOutlineProvider(RevealOutlineAnimation.this);
revealView.setClipToOutline(true);
if (shouldRemoveElevationDuringAnimation()) {
revealView.setTranslationZ(-elevation);
}
}
代码示例来源:origin: klinker24/Android-Blur-Launcher
public void onAnimationEnd(Animator animation) {
if (!mWasCanceled) {
revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
revealView.setClipToOutline(false);
if (shouldRemoveElevationDuringAnimation()) {
revealView.setTranslationZ(0);
}
}
}
代码示例来源:origin: klinker24/Android-Blur-Launcher
public void onAnimationStart(Animator animation) {
revealView.setOutlineProvider(RevealOutlineAnimation.this);
revealView.setClipToOutline(true);
if (shouldRemoveElevationDuringAnimation()) {
revealView.setTranslationZ(-elevation);
}
}
代码示例来源:origin: klinker24/launcher3
public void onAnimationEnd(Animator animation) {
if (!mWasCanceled) {
revealView.setOutlineProvider(ViewOutlineProvider.BACKGROUND);
revealView.setClipToOutline(false);
if (shouldRemoveElevationDuringAnimation()) {
revealView.setTranslationZ(0);
}
}
}
代码示例来源:origin: enricocid/LaunchEnr
public void onAnimationStart(Animator animation) {
revealView.setOutlineProvider(RevealOutlineAnimation.this);
revealView.setClipToOutline(true);
if (shouldRemoveElevationDuringAnimation()) {
revealView.setTranslationZ(-elevation);
}
}
内容来源于网络,如有侵权,请联系作者删除!