當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。