ViewCompat.setZ(view, z); ViewCompat.setTranslationX(view, x); ViewCompat.setAlpha(view, alpha);
protected void onUpdateViewZ(@NonNull View view, float z) { if (ViewCompat.getZ(view) != z) { ViewCompat.setZ(view, z); } }
@Override public void onAnimationEnd(Animator animation) { mIsAnimating = false; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for (View b : mButtons) { ((FloatingActionButton) b).setCompatElevation(elevation); } ViewCompat.setZ(mRingView, elevation); } } });
@Override public void onAnimationStart(Animator animation) { mIsAnimating = true; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { bringChildToFront(mRingView); bringChildToFront(button); } else { button.setCompatElevation(elevation + 1); ViewCompat.setZ(mRingView, elevation + 1); for (View b : mButtons) { if (b != button) { ((FloatingActionButton) b).setCompatElevation(0); } } } mRingView.setScaleX(1f); mRingView.setScaleY(1f); mRingView.setVisibility(View.VISIBLE); } @Override
private void layoutInternal() { final boolean isViewIdle = isViewIdle(); if (mIsDebug) Log.i(getDebugTag(), "layoutInternal isViewIdle:" + isViewIdle); mViewNormal.layout(0, 0, mViewNormal.getMeasuredWidth(), mViewNormal.getMeasuredHeight()); mViewChecked.layout(0, 0, mViewChecked.getMeasuredWidth(), mViewChecked.getMeasuredHeight()); int left = 0; int top = mAttrModel.getMarginTop(); if (isViewIdle) { left = mIsChecked ? getLeftChecked() : getLeftNormal(); } else { left = mViewThumb.getLeft(); } mViewThumb.layout(left, top, left + mViewThumb.getMeasuredWidth(), top + mViewThumb.getMeasuredHeight()); final float backZ = Math.max(ViewCompat.getZ(mViewNormal), ViewCompat.getZ(mViewChecked)); if (ViewCompat.getZ(mViewThumb) <= backZ) ViewCompat.setZ(mViewThumb, backZ + 1); dealViewIdle(); }