當前位置: 首頁>>代碼示例>>Java>>正文


Java View.getMatrix方法代碼示例

本文整理匯總了Java中android.view.View.getMatrix方法的典型用法代碼示例。如果您正苦於以下問題:Java View.getMatrix方法的具體用法?Java View.getMatrix怎麽用?Java View.getMatrix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.getMatrix方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMatrix

import android.view.View; //導入方法依賴的package包/類
public float[] getMatrix() {
    if (mMatrix != null) {
        return mMatrix;
    } else {
        final View view = getView();
        if (view != null) {
            Matrix matrix = view.getMatrix();
            if (matrix != null) {
                mMatrix = new float[9];
                matrix.getValues(mMatrix);
                return mMatrix;
            }
        }
    }
    return null;
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:17,代碼來源:UDView.java

示例2: transformMotionEventToLocal

import android.view.View; //導入方法依賴的package包/類
/**
 * Recursive helper method that applies transformations in post-order.
 *
 * @param ev the on-screen motion event
 */
private static void transformMotionEventToLocal(@NonNull View view, @NonNull MotionEvent ev) {
    final ViewParent parent = view.getParent();
    if (parent instanceof View) {
        final View vp = (View) parent;
        transformMotionEventToLocal(vp, ev);
        ev.offsetLocation(vp.getScrollX(), vp.getScrollY());
    } // TODO: Use reflections to access ViewRootImpl
    // else if (parent instanceof ViewRootImpl) {
    //    final ViewRootImpl vr = (ViewRootImpl) parent;
    //    ev.offsetLocation(0, vr.mCurScrollY);
    // }

    ev.offsetLocation(-view.getLeft(), -view.getTop());

    Matrix matrix = view.getMatrix();
    if (matrix != null) {
        ev.transform(matrix);
    }
}
 
開發者ID:ujjwalagrawal17,項目名稱:CodeCompilerApp,代碼行數:25,代碼來源:ViewUtils.java

示例3: transformMotionEventToGlobal

import android.view.View; //導入方法依賴的package包/類
/**
 * Recursive helper method that applies transformations in pre-order.
 *
 * @param ev the on-screen motion event
 */
private static void transformMotionEventToGlobal(@NonNull View view, @NonNull MotionEvent ev) {
    Matrix matrix = view.getMatrix();
    if (matrix != null) {
        ev.transform(matrix);
    }

    ev.offsetLocation(view.getLeft(), view.getTop());

    final ViewParent parent = view.getParent();
    if (parent instanceof View) {
        final View vp = (View) parent;
        ev.offsetLocation(-vp.getScrollX(), -vp.getScrollY());
        transformMotionEventToGlobal(vp, ev);
    } // TODO: Use reflections to access ViewRootImpl
    // else if (parent instanceof ViewRootImpl) {
    //    final ViewRootImpl vr = (ViewRootImpl) parent;
    //    ev.offsetLocation(0, -vr.mCurScrollY);
    // }
}
 
開發者ID:ujjwalagrawal17,項目名稱:CodeCompilerApp,代碼行數:25,代碼來源:ViewUtils.java

示例4: isTransformedTouchPointInView

import android.view.View; //導入方法依賴的package包/類
/**
 * Returns whether the touch point is within the child View
 * It is transform aware and will invert the transform Matrix to find the true local points
 * This code is taken from {@link ViewGroup#isTransformedTouchPointInView()}
 */
private static boolean isTransformedTouchPointInView(
    float x,
    float y,
    ViewGroup parent,
    View child,
    PointF outLocalPoint) {
  float localX = x + parent.getScrollX() - child.getLeft();
  float localY = y + parent.getScrollY() - child.getTop();
  Matrix matrix = child.getMatrix();
  if (!matrix.isIdentity()) {
    float[] localXY = mMatrixTransformCoords;
    localXY[0] = localX;
    localXY[1] = localY;
    Matrix inverseMatrix = mInverseMatrix;
    matrix.invert(inverseMatrix);
    inverseMatrix.mapPoints(localXY);
    localX = localXY[0];
    localY = localXY[1];
  }
  if (child instanceof ReactHitSlopView && ((ReactHitSlopView) child).getHitSlopRect() != null) {
    Rect hitSlopRect = ((ReactHitSlopView) child).getHitSlopRect();
    if ((localX >= -hitSlopRect.left && localX < (child.getRight() - child.getLeft()) + hitSlopRect.right)
        && (localY >= -hitSlopRect.top && localY < (child.getBottom() - child.getTop()) + hitSlopRect.bottom)) {
      outLocalPoint.set(localX, localY);
      return true;
    }

    return false;
  } else {
    if ((localX >= 0 && localX < (child.getRight() - child.getLeft()))
        && (localY >= 0 && localY < (child.getBottom() - child.getTop()))) {
      outLocalPoint.set(localX, localY);
      return true;
    }

    return false;
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:44,代碼來源:TouchTargetHelper.java


注:本文中的android.view.View.getMatrix方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。