android.view.View#getScaleX ( )源码实例Demo

下面列出了android.view.View#getScaleX ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: scene   文件: ChangeTransform.java
Transforms(View view) {
    mTranslationX = view.getTranslationX();
    mTranslationY = view.getTranslationY();
    mTranslationZ = ViewCompat.getTranslationZ(view);
    mScaleX = view.getScaleX();
    mScaleY = view.getScaleY();
    mRotationX = view.getRotationX();
    mRotationY = view.getRotationY();
    mRotationZ = view.getRotation();
}
 
源代码2 项目: android_9.0.0_r45   文件: ChangeTransform.java
public Transforms(View view) {
    translationX = view.getTranslationX();
    translationY = view.getTranslationY();
    translationZ = view.getTranslationZ();
    scaleX = view.getScaleX();
    scaleY = view.getScaleY();
    rotationX = view.getRotationX();
    rotationY = view.getRotationY();
    rotationZ = view.getRotation();
}
 
源代码3 项目: SchoolQuest   文件: LessonB.java
private boolean isViewOverlapping(View firstView, View secondView) {
    int[] firstPosition = new int[2];
    int[] secondPosition = new int[2];

    firstView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    firstView.getLocationOnScreen(firstPosition);
    secondView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
    secondView.getLocationOnScreen(secondPosition);

    float firstWidth = firstView.getMeasuredWidth() * firstView.getScaleX();
    float secondWidth = secondView.getMeasuredWidth() * secondView.getScaleX();

    return firstPosition[0] < secondPosition[0] + secondWidth
            && firstPosition[0] + firstWidth > secondPosition[0];
}
 
源代码4 项目: morphos   文件: ViewDefault.java
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();
    }
}
 
源代码5 项目: DevUtils   文件: ViewUtils.java
/**
 * 获取 View 水平方向缩放比例
 * @param view View
 * @return View 水平方向缩放比例
 */
public static float getScaleX(final View view) {
    if (view != null) {
        return view.getScaleX();
    }
    return 0f;
}
 
源代码6 项目: ucar-weex-core   文件: WXSliderNeighbor.java
private void updateScaleAndAlpha(View view, float alpha, float scale) {
    if(null == view) {
        return;
    }
    if(alpha >= 0 && view.getAlpha() != alpha) {
        view.setAlpha(alpha);
    }
    if(scale >= 0 && view.getScaleX() != scale) {
        view.setScaleX(scale);
        view.setScaleY(scale);
    }
}
 
源代码7 项目: Transitions-Everywhere   文件: Scale.java
@Nullable
private Animator createAnimation(@NonNull final View view, float startScale, float endScale, @Nullable TransitionValues values) {
    final float initialScaleX = view.getScaleX();
    final float initialScaleY = view.getScaleY();
    float startScaleX = initialScaleX * startScale;
    float endScaleX = initialScaleX * endScale;
    float startScaleY = initialScaleY * startScale;
    float endScaleY = initialScaleY * endScale;

    if (values != null) {
        Float savedScaleX = (Float) values.values.get(PROPNAME_SCALE_X);
        Float savedScaleY = (Float) values.values.get(PROPNAME_SCALE_Y);
        // if saved value is not equal initial value it means that previous
        // transition was interrupted and in the onTransitionEnd
        // we've applied endScale. we should apply proper value to
        // continue animation from the interrupted state
        if (savedScaleX != null && savedScaleX != initialScaleX) {
            startScaleX = savedScaleX;
        }
        if (savedScaleY != null && savedScaleY != initialScaleY) {
            startScaleY = savedScaleY;
        }
    }

    view.setScaleX(startScaleX);
    view.setScaleY(startScaleY);

    Animator animator = TransitionUtils.mergeAnimators(
        ObjectAnimator.ofFloat(view, View.SCALE_X, startScaleX, endScaleX),
        ObjectAnimator.ofFloat(view, View.SCALE_Y, startScaleY, endScaleY));
    addListener(new TransitionListenerAdapter() {
        @Override
        public void onTransitionEnd(@NonNull Transition transition) {
            view.setScaleX(initialScaleX);
            view.setScaleY(initialScaleY);
            transition.removeListener(this);
        }
    });
    return animator;
}
 
源代码8 项目: Transitions-Everywhere   文件: ChangeTransform.java
public Transforms(View view) {
    translationX = view.getTranslationX();
    translationY = view.getTranslationY();
    translationZ = ViewUtils.getTranslationZ(view);
    scaleX = view.getScaleX();
    scaleY = view.getScaleY();
    rotationX = view.getRotationX();
    rotationY = view.getRotationY();
    rotationZ = view.getRotation();
}
 
源代码9 项目: Trebuchet   文件: CellLayout.java
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;
}
 
源代码10 项目: photo-editor-android   文件: MultiTouchListener.java
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);
}
 
源代码11 项目: MultiView   文件: ViewUtils.java
public static boolean isItemAtPoint(View view, float x, float y) {
    return (view.getLeft() < x) && (view.getLeft() + view.getWidth() * view.getScaleX() > x)
            && (view.getTop() < y) && (view.getTop() + view.getHeight() * view.getScaleY() > y)
            ;

}
 
源代码12 项目: TurboLauncher   文件: DragLayer.java
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;
        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);
}
 
源代码13 项目: MiBandDecompiled   文件: a.java
static float g(View view)
{
    return view.getScaleX();
}
 
源代码14 项目: social-app-android   文件: AnimationUtils.java
public static boolean isViewHiddenByScale(View v) {
    return v.getScaleX() == 0 && v.getScaleY() == 0;
}
 
源代码15 项目: WIFIADB   文件: ScaleProperty.java
@Override
public Float get(View object) {
    return object.getScaleX();
}
 
源代码16 项目: UltimateAndroid   文件: ViewHelper.java
static float getScaleX(View view) {
    return view.getScaleX();
}
 
@Override
protected float getProperty(View view) {
  return view.getScaleX();
}
 
源代码18 项目: LB-Launcher   文件: DragLayer.java
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);
}
 
源代码19 项目: pushdown-anim-click   文件: PushDownAnim.java
private PushDownAnim( final View view ){
    this.weakView = new WeakReference<>(view) ;
    this.weakView.get().setClickable( true );
    defaultScale = view.getScaleX();
}
 
源代码20 项目: RecyclerBanner   文件: OverFlyingLayoutManager.java
/**
 * cause elevation is not support below api 21,
 * so you can set your elevation here for supporting it below api 21
 * or you can just setElevation in {@link #setItemViewProperty(View, float)}
 */
protected float setViewElevation(View itemView, float targetOffset) {
    return itemView.getScaleX() * 5;
}
 
 方法所在类
 同类方法