本文整理汇总了Java中android.view.View.setTranslationZ方法的典型用法代码示例。如果您正苦于以下问题:Java View.setTranslationZ方法的具体用法?Java View.setTranslationZ怎么用?Java View.setTranslationZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setTranslationZ方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: disable
import android.view.View; //导入方法依赖的package包/类
/**
* Helper function to disable a ViewGroup and all it's children. This draws a new view with z-ordering of integer max
* that consumes all touch events.
* @param viewGroup
*/
public static void disable(ViewGroup viewGroup){
View view = new View(viewGroup.getContext());
viewGroup.addView(view);
view.setTag(DISABLE);
ViewGroup.LayoutParams params = view.getLayoutParams();
params.height = MATCH_PARENT;
params.width = MATCH_PARENT;
view.setLayoutParams(params);
view.setClickable(true);
view.setFocusable(true);
view.setFocusableInTouchMode(true);
view.setBackgroundColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= 21) {
view.setTranslationZ(Integer.MAX_VALUE);
}
viewGroup.bringChildToFront(view);
}
示例2: transformPage
import android.view.View; //导入方法依赖的package包/类
@Override
public void transformPage(View page, float position) {
if (position > -1 && position < 1) {
float scale = Math.max(MIN_SCALE, MAX_SCALE - Math.abs(position) * (MAX_SCALE - MIN_SCALE));
page.setScaleY(scale);
page.setScaleX(scale);
float transZ = Math.max(MIN_TRANSLATION_Z, MAX_TRANSLATION_Z - Math.abs(position)
* (MAX_TRANSLATION_Z - MIN_TRANSLATION_Z));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
page.setTranslationZ(transZ);
}
if (position == 0) {
Log.e(TAG, "transformPage执行scale 被执行者:" + page.toString());
}
} else {
page.setScaleY(MIN_SCALE);
page.setScaleX(MIN_SCALE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
page.setTranslationZ(MIN_TRANSLATION_Z);
}
}
}
示例3: restoreView
import android.view.View; //导入方法依赖的package包/类
private void restoreView(View v) {
v.setVisibility(endVisibility);
v.setPivotY(v.getHeight() / 2);
v.setPivotX(v.getWidth() / 2);
v.setRotation(0);
v.setRotationX(0);
v.setRotationY(0);
v.setTranslationX(0);
v.setTranslationY(0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
v.setTranslationZ(0);
}
}
示例4: toStartState
import android.view.View; //导入方法依赖的package包/类
@Override
protected void toStartState(View view) {
view.setTranslationX(fromX);
view.setTranslationY(fromY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setTranslationZ(fromZ);
}
示例5: toMiddleState
import android.view.View; //导入方法依赖的package包/类
@Override
protected void toMiddleState(View view, float offset) {
view.setTranslationX(fromX + (toX - fromX) * offset);
view.setTranslationY(fromY + (toY - fromY) * offset);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setTranslationZ(fromZ + (toZ - fromZ) * offset);
}
示例6: toEndState
import android.view.View; //导入方法依赖的package包/类
@Override
protected void toEndState(View view) {
view.setTranslationX(toX);
view.setTranslationY(toY);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) view.setTranslationZ(toZ);
}
示例7: addTouchInterceptor
import android.view.View; //导入方法依赖的package包/类
/**
* Adds a touch interceptor to the layout when needed.
* The interceptor wil take care of touch events occurring
* on the content view when the drawer is open.
*/
private void addTouchInterceptor() {
View touchInterceptor = mLayoutInflater.inflate(R.layout.duo_overlay, this, false);
touchInterceptor.setTag(TAG_OVERLAY);
touchInterceptor.setOnTouchListener(new OnTouchListener() {
float startX;
float startY;
@Override
public boolean onTouch(View v, MotionEvent event) {
if (mLockMode != LOCK_MODE_LOCKED_OPEN) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
startX = event.getX();
startY = event.getY();
break;
case MotionEvent.ACTION_UP:
float endX = event.getX();
float endY = event.getY();
if (touchIsClick(startX, endX, startY, endY)) {
closeDrawer();
}
break;
case MotionEvent.ACTION_MOVE:
mViewDragCallback.mIsEdgeDrag = true;
int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
mViewDragHelper.captureChildView(mContentView, pointerIndex);
break;
}
return true;
} else return true;
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
touchInterceptor.setTranslationZ(MAX_ATTRIBUTE_MULTIPLIER);
}
addView(touchInterceptor);
}
示例8: setTranslationZ
import android.view.View; //导入方法依赖的package包/类
public static void setTranslationZ(View view, float translationZ) {
view.setTranslationZ(translationZ);
}