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


Java View.getScaleX方法代码示例

本文整理汇总了Java中android.view.View.getScaleX方法的典型用法代码示例。如果您正苦于以下问题:Java View.getScaleX方法的具体用法?Java View.getScaleX怎么用?Java View.getScaleX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.View的用法示例。


在下文中一共展示了View.getScaleX方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transformPage

import android.view.View; //导入方法依赖的package包/类
@Override
public void transformPage(View page, float position) {
    if (position < -1) {
        position = -1;
    } else if (position > 1) {
        position = 1;
    }

    float tempScale = position < 0 ? 1 + position : 1 - position;
    float slope = (MAX_SCALE - MIN_SCALE) / 1;
    float scaleValue = MIN_SCALE + tempScale * slope;

    float pivotX = page.getWidth() * page.getScaleX() / 2.f;
    float pivotY = page.getHeight();
    page.setPivotX(pivotX);
    page.setPivotY(pivotY);
    page.setScaleX(scaleValue);
    page.setScaleY(scaleValue);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        page.getParent().requestLayout();
    }
}
 
开发者ID:wuzhendev,项目名称:android-xgallery,代码行数:24,代码来源:BottomScalePageTransformer.java

示例2: getValue

import android.view.View; //导入方法依赖的package包/类
/**
 * This method gets the value of the named property from the View object.
 *
 * @param propertyConstant The property whose value should be returned
 * @return float The value of the named property
 */
private float getValue(int propertyConstant) {
    //final View.TransformationInfo info = mView.mTransformationInfo;
    View v = mView.get();
    if (v != null) {
        switch (propertyConstant) {
            case TRANSLATION_X:
                //return info.mTranslationX;
                return v.getTranslationX();
            case TRANSLATION_Y:
                //return info.mTranslationY;
                return v.getTranslationY();
            case ROTATION:
                //return info.mRotation;
                return v.getRotation();
            case ROTATION_X:
                //return info.mRotationX;
                return v.getRotationX();
            case ROTATION_Y:
                //return info.mRotationY;
                return v.getRotationY();
            case SCALE_X:
                //return info.mScaleX;
                return v.getScaleX();
            case SCALE_Y:
                //return info.mScaleY;
                return v.getScaleY();
            case X:
                //return v.mLeft + info.mTranslationX;
                return v.getX();
            case Y:
                //return v.mTop + info.mTranslationY;
                return v.getY();
            case ALPHA:
                //return info.mAlpha;
                return v.getAlpha();
        }
    }
    return 0;
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:46,代码来源:ViewPropertyAnimatorHC.java

示例3: viewToRect

import android.view.View; //导入方法依赖的package包/类
@Override
public void viewToRect(View v, Rect outRect) {
    outRect.left = 0;
    outRect.top = 0;

    computeLocationRelativeToContainer(v, outRect);

    // If a view is scaled, its position will also shift accordingly. For optimization, only
    // consider this for the last node.
    outRect.left += (1 - v.getScaleX()) * v.getWidth() / 2;
    outRect.top += (1 - v.getScaleY()) * v.getHeight() / 2;

    outRect.right = outRect.left + (int) (v.getScaleX() * v.getWidth());
    outRect.bottom = outRect.top + (int) (v.getScaleY() * v.getHeight());
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:16,代码来源:ViewGroupFocusHelper.java

示例4: updateView

import android.view.View; //导入方法依赖的package包/类
public void updateView(View v) {
    if (v != null) {
        this.alpha = v.getAlpha();
        this.x = v.getX();
        this.y = v.getY();
        this.z = atLeastLollipop ? v.getZ() : 0;
        this.width = v.getWidth();
        this.height = v.getHeight();
        this.expansionScaleX = v.getScaleX();
        this.expansionScaleY = v.getScaleY();
        this.dispositionAngle = v.getRotation();
        this.dispositionAngleX = v.getRotationX();
        this.dispositionAngleY = v.getRotationY();
    }
}
 
开发者ID:rjsvieira,项目名称:morphos,代码行数:16,代码来源:ViewDefault.java

示例5: move

import android.view.View; //导入方法依赖的package包/类
private static void move(View view, TransformInfo info) {
    computeRenderOffset(view, info.pivotX, info.pivotY);
    adjustTranslation(view, info.deltaX, info.deltaY);

    float scale = view.getScaleX() * info.deltaScale;
    scale = Math.max(info.minimumScale, Math.min(info.maximumScale, scale));
    view.setScaleX(scale);
    view.setScaleY(scale);

    float rotation = adjustAngle(view.getRotation() + info.deltaAngle);
    view.setRotation(rotation);
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:13,代码来源:MultiTouchListener.java

示例6: ReorderPreviewAnimation

import android.view.View; //导入方法依赖的package包/类
public ReorderPreviewAnimation(View child, int mode, int cellX0, int cellY0, int cellX1,
        int cellY1, int spanX, int spanY) {
    regionToCenterPoint(cellX0, cellY0, spanX, spanY, mTmpPoint);
    final int x0 = mTmpPoint[0];
    final int y0 = mTmpPoint[1];
    regionToCenterPoint(cellX1, cellY1, spanX, spanY, mTmpPoint);
    final int x1 = mTmpPoint[0];
    final int y1 = mTmpPoint[1];
    final int dX = x1 - x0;
    final int dY = y1 - y0;
    finalDeltaX = 0;
    finalDeltaY = 0;
    int dir = mode == MODE_HINT ? -1 : 1;
    if (dX == dY && dX == 0) {
    } else {
        if (dY == 0) {
            finalDeltaX = - dir * Math.signum(dX) * mReorderPreviewAnimationMagnitude;
        } else if (dX == 0) {
            finalDeltaY = - dir * Math.signum(dY) * mReorderPreviewAnimationMagnitude;
        } else {
            double angle = Math.atan( (float) (dY) / dX);
            finalDeltaX = (int) (- dir * Math.signum(dX) *
                    Math.abs(Math.cos(angle) * mReorderPreviewAnimationMagnitude));
            finalDeltaY = (int) (- dir * Math.signum(dY) *
                    Math.abs(Math.sin(angle) * mReorderPreviewAnimationMagnitude));
        }
    }
    this.mode = mode;
    initDeltaX = child.getTranslationX();
    initDeltaY = child.getTranslationY();
    finalScale = getChildrenScale() - 4.0f / child.getWidth();
    initScale = child.getScaleX();
    this.child = child;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:35,代码来源:CellLayout.java

示例7: getScaleX

import android.view.View; //导入方法依赖的package包/类
public static float getScaleX(View view) {
    if (View10.NEED_PROXY) {
        return View10.wrap(view).getScaleX();
    } else {
        return view.getScaleX();
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:8,代码来源:ViewProxy.java

示例8: getScaleX

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

示例9: getScaleX

import android.view.View; //导入方法依赖的package包/类
static float getScaleX(View view) {
    return view.getScaleX();
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:4,代码来源:ViewHelper.java

示例10: getProperty

import android.view.View; //导入方法依赖的package包/类
@Override
protected void getProperty(View view, float[] returnValues) {
  returnValues[0] = view.getScaleX();
  returnValues[1] = view.getScaleY();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:6,代码来源:ScaleXYAnimationPairPropertyUpdater.java

示例11: getProperty

import android.view.View; //导入方法依赖的package包/类
@Override
protected float getProperty(View view) {
  return view.getScaleX();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:5,代码来源:ScaleXAnimationPropertyUpdater.java

示例12: onDraw

import android.view.View; //导入方法依赖的package包/类
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

//        Log.i(TAG, "onDraw: " + x + " " + y);
        float width = getWidth() / 2.0f;
        float height = getHeight() / 2.0f;
        View childAt = getChildAt(0);


        //画固定底片

        if (adapter.tQueue.size() > 1) {
            float s_width1 = childAt.getWidth() * mScale;
            float s_height1 = childAt.getHeight() * mScale;
            float dx1 = (s_width1 - s_width1 * mScale) / 2;
            float l1 = width - s_width1 / 2 + dx1;
            float t1 = height + s_height1 / 2 + mTranslate;
            float r1 = width + s_width1 / 2 - dx1;
            float b1 = t1 + mDy;

            rect.left = l1;
            rect.top = t1 - 20 * density;
            rect.right = r1;
            rect.bottom = b1;
            canvas.drawRoundRect(rect, round, round, paint);
            canvas.drawRoundRect(rect, round, round, paint_s);
        }


        if (adapter.tQueue.size() > 0) {
            float scaleX = childAt.getScaleX();
            float s_width = childAt.getWidth() * scaleX;
            float s_height = childAt.getHeight() * scaleX;

            float dx = (s_width - s_width * mScale) / 2;
            float l = width - s_width / 2 + dx;
            float t = height + s_height / 2 + childAt.getTranslationY();
            float r = width + s_width / 2 - dx;
            float b = t + mDy;

            rect.left = l;
            rect.top = t - 20 * density;
            rect.right = r;
            rect.bottom = b;
            canvas.drawRoundRect(rect, round, round, paint);
            canvas.drawRoundRect(rect, round, round, paint_s);
        }

    }
 
开发者ID:pop1234o,项目名称:BestPracticeApp,代码行数:51,代码来源:SwipeCardLayout.java

示例13: animateViewIntoPosition

import android.view.View; //导入方法依赖的package包/类
public void animateViewIntoPosition(DragView dragView, final View child, int duration,
        final Runnable onFinishAnimationRunnable, View anchorView) {
    ShortcutAndWidgetContainer parentChildren = (ShortcutAndWidgetContainer) child.getParent();
    CellLayout.LayoutParams lp =  (CellLayout.LayoutParams) child.getLayoutParams();
    parentChildren.measureChild(child);

    Rect r = new Rect();
    getViewRectRelativeToSelf(dragView, r);

    int coord[] = new int[2];
    float childScale = child.getScaleX();
    coord[0] = lp.x + (int) (child.getMeasuredWidth() * (1 - childScale) / 2);
    coord[1] = lp.y + (int) (child.getMeasuredHeight() * (1 - childScale) / 2);

    // Since the child hasn't necessarily been laid out, we force the lp to be updated with
    // the correct coordinates (above) and use these to determine the final location
    float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord);
    // We need to account for the scale of the child itself, as the above only accounts for
    // for the scale in parents.
    scale *= childScale;
    int toX = coord[0];
    int toY = coord[1];
    float toScale = scale;
    if (child instanceof TextView) {
        TextView tv = (TextView) child;
        // Account for the source scale of the icon (ie. from AllApps to Workspace, in which
        // the workspace may have smaller icon bounds).
        toScale = scale / dragView.getIntrinsicIconScaleFactor();

        // The child may be scaled (always about the center of the view) so to account for it,
        // we have to offset the position by the scaled size.  Once we do that, we can center
        // the drag view about the scaled child view.
        toY += Math.round(toScale * tv.getPaddingTop());
        toY -= dragView.getMeasuredHeight() * (1 - toScale) / 2;
        if (dragView.getDragVisualizeOffset() != null) {
            toY -=  Math.round(toScale * dragView.getDragVisualizeOffset().y);
        }

        toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
    } else if (child instanceof FolderIcon) {
        // Account for holographic blur padding on the drag view
        toY += Math.round(scale * (child.getPaddingTop() - dragView.getDragRegionTop()));
        toY -= scale * Workspace.DRAG_BITMAP_PADDING / 2;
        toY -= (1 - scale) * dragView.getMeasuredHeight() / 2;
        // Center in the x coordinate about the target's drawable
        toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
    } else {
        toY -= (Math.round(scale * (dragView.getHeight() - child.getMeasuredHeight()))) / 2;
        toX -= (Math.round(scale * (dragView.getMeasuredWidth()
                - child.getMeasuredWidth()))) / 2;
    }

    final int fromX = r.left;
    final int fromY = r.top;
    child.setVisibility(INVISIBLE);
    Runnable onCompleteRunnable = new Runnable() {
        public void run() {
            child.setVisibility(VISIBLE);
            if (onFinishAnimationRunnable != null) {
                onFinishAnimationRunnable.run();
            }
        }
    };
    animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, toScale, toScale,
            onCompleteRunnable, ANIMATION_END_DISAPPEAR, duration, anchorView);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:67,代码来源:DragLayer.java

示例14: cacheData

import android.view.View; //导入方法依赖的package包/类
private void cacheData(View view) {
    mPageScaleX = view.getScaleX();
    mPageScaleY = view.getScaleY();
    mScaleX = getScaleX();
    mScaleY = getScaleY();
}
 
开发者ID:codeestX,项目名称:ECardFlow,代码行数:7,代码来源:ECardFlow.java


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