当前位置: 首页>>代码示例>>Java>>正文


Java View.setTranslationZ方法代码示例

本文整理汇总了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);
}
 
开发者ID:kevinwang5658,项目名称:backstack,代码行数:26,代码来源:Helper.java

示例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);
        }
    }
}
 
开发者ID:walkthehorizon,项目名称:MzViewPager,代码行数:23,代码来源:ScaleYTransformer.java

示例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);
    }
}
 
开发者ID:cmfsotelo,项目名称:FlipLayout,代码行数:14,代码来源:FlipLayout.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:WoWoTranslation3DAnimation.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:WoWoTranslation3DAnimation.java

示例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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:WoWoTranslation3DAnimation.java

示例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);
}
 
开发者ID:PSD-Company,项目名称:duo-navigation-drawer,代码行数:47,代码来源:DuoDrawerLayout.java

示例8: setTranslationZ

import android.view.View; //导入方法依赖的package包/类
public static void setTranslationZ(View view, float translationZ) {
    view.setTranslationZ(translationZ);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:4,代码来源:ViewCompatLollipop.java


注:本文中的android.view.View.setTranslationZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。