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


Java Point.set方法代碼示例

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


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

示例1: getContentSize

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * 獲取屏幕寬高
 * @param context
 * @param contentOffset
 * @return
 */
public static Point getContentSize(Activity context, float contentOffset) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point out = new Point();
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(out);
    } else {
        int width = display.getWidth();
        int height = display.getHeight();
        out.set(width, height);
    }
    if (contentOffset > 0) {
        out.y -= contentOffset;
    }
    return out;
}
 
開發者ID:halohoop,項目名稱:UsoppBubble,代碼行數:23,代碼來源:Utils.java

示例2: getViewMidPoint

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * 該方法用於回一個View的終點坐標 如果該View不存在則返回(0,0)
 *
 * @param view
 * @return
 */
private Point getViewMidPoint(View view) {
	Point point = new Point();
	if (view != null) {
		float xx = view.getX();
		float yy = view.getY();
		int center_x = (int) (xx + view.getWidth() / 2);
		int center_y = (int) (yy + view.getHeight() / 2);
		point.set(center_x, center_y);
	} else {
		point.set(0, 0);
	}
	return point;
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:20,代碼來源:MyRelativeLayout.java

示例3: drawSelector

import android.graphics.Point; //導入方法依賴的package包/類
private void drawSelector(Canvas canvas, int posX, int posY) {
    if (isSelected || hasFocus()) {
        paint.setColor(highlightColor);
    } else {
        paint.setColor(isEnabled() ? arrowColor : disabledColor);
    }

    Point point1 = selectorPoints[0];
    Point point2 = selectorPoints[1];
    Point point3 = selectorPoints[2];

    point1.set(posX, posY);
    point2.set((int) (posX - (arrowSize)), posY);
    point3.set((int) (posX - (arrowSize / 2)), (int) (posY + (arrowSize / 2)));

    selectorPath.reset();
    selectorPath.moveTo(point1.x, point1.y);
    selectorPath.lineTo(point2.x, point2.y);
    selectorPath.lineTo(point3.x, point3.y);
    selectorPath.close();
    canvas.drawPath(selectorPath, paint);
}
 
開發者ID:hamsaadev,項目名稱:RTLMaterialSpinner,代碼行數:23,代碼來源:RtlMaterialSpinner.java

示例4: drawSelector

import android.graphics.Point; //導入方法依賴的package包/類
private void drawSelector(Canvas canvas, int posX, int posY) {
    if (isSelected) {
        paint.setColor(highlightColor);
    } else {
        paint.setColor(isEnabled() ? arrowColor : disabledColor);
    }

    Point point1 = selectorPoints[0];
    Point point2 = selectorPoints[1];
    Point point3 = selectorPoints[2];

    point1.set(posX, posY);
    point2.set((int) (posX - (arrowSize)), posY);
    point3.set((int) (posX - (arrowSize / 2)), (int) (posY + (arrowSize / 2)));

    selectorPath.reset();
    selectorPath.moveTo(point1.x, point1.y);
    selectorPath.lineTo(point2.x, point2.y);
    selectorPath.lineTo(point3.x, point3.y);
    selectorPath.close();
    canvas.drawPath(selectorPath, paint);
}
 
開發者ID:mityung,項目名稱:XERUNG,代碼行數:23,代碼來源:MaterialSpinner.java

示例5: scalePoint

import android.graphics.Point; //導入方法依賴的package包/類
private Point scalePoint(Point point, int width, int height) {
    if (point == null)
        return null;
    mScreenMetrics.setDesignHeight(height);
    mScreenMetrics.setDesignWidth(width);
    point.set(mScreenMetrics.scaleX(point.x), mScreenMetrics.scaleY(point.y));
    return point;
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:9,代碼來源:ColorFinder.java

示例6: onProvideShadowMetrics

import android.graphics.Point; //導入方法依賴的package包/類
@Override
public void onProvideShadowMetrics (Point size, Point touch) {
    final int width, height;

    width = (int) (getView().getWidth());
    height = (int) (getView().getHeight());

    shadow.setBounds(0, 0, width, height);
    size.set(width, height);
    touch.set(offset.x, offset.y);
}
 
開發者ID:dmallcott,項目名稱:DismissibleImageView,代碼行數:12,代碼來源:DismissibleDragShadowBuilder.java

示例7: init

import android.graphics.Point; //導入方法依賴的package包/類
private void init() {
    hotPath = new Path();
    int x1 =  DisplayUtil.dip2px(getContext(),290);
    int x2 = DisplayUtil.dip2px(getContext(),324);
    int x3 = DisplayUtil.dip2px(getContext(),307);
    int y1 = DisplayUtil.dip2px(getContext(),0);
    int y2 = DisplayUtil.dip2px(getContext(),24);
    int y3 = DisplayUtil.dip2px(getContext(),38);
    hotPath.moveTo(x1,y1);
    hotPath.lineTo(x2,y1);
    hotPath.lineTo(x2,y2);
    hotPath.lineTo(x3,y3);
    hotPath.lineTo(x1,y2);
    hotPath.close();

    lsPoint = new Point();
    lsPoint.set(x1 - 3,0);

    lePoint = new Point();
    lePoint.set(x2,0);

    rTitlePoint = new Point();
    rTitlePoint.set(x3, (y1 + y3 - 4)/2);

    hotPaint = new Paint();
    hotPaint.setColor(Color.RED);
    hotPaint.setShadowLayer(2,-2,-1,Color.DKGRAY);

    ColorMatrix colorMatrix = new ColorMatrix(new float[]{
            0.8f,0,0,0,0,
            0,0,0,0,0,
            0,0,0,0,0,
            0,0,0,1,0
    });
    lineFilter = new ColorMatrixColorFilter(colorMatrix);
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:37,代碼來源:HotLayout.java

示例8: resolveRelativeTouchPosition

import android.graphics.Point; //導入方法依賴的package包/類
private Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
  if (locationOnScreen == null) {
    locationOnScreen = new int[2];
    touchPosition = new Point();
  }
  getLocationOnScreen(locationOnScreen);
  touchPosition.set(
      ((int) motionEvent.getRawX()) - locationOnScreen[0],
      ((int) motionEvent.getRawY()) - locationOnScreen[1]);
  return touchPosition;
}
 
開發者ID:yangchaojiang,項目名稱:yjPlay,代碼行數:12,代碼來源:DefaultTimeBar.java

示例9: getScreenDimensions

import android.graphics.Point; //導入方法依賴的package包/類
public static Point getScreenDimensions(Context context) {
	WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
	Display display = wm.getDefaultDisplay();

	DisplayMetrics dm = new DisplayMetrics();
	display.getMetrics(dm);

	Point point = new Point();
	point.set(dm.widthPixels, dm.heightPixels);
	return point;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:Utils.java

示例10: getScreenResolution

import android.graphics.Point; //導入方法依賴的package包/類
public static Point getScreenResolution(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point screenResolution = new Point();
    if (android.os.Build.VERSION.SDK_INT >= 13) {
        display.getSize(screenResolution);
    } else {
        screenResolution.set(display.getWidth(), display.getHeight());
    }
    return screenResolution;
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:12,代碼來源:BGAQRCodeUtil.java

示例11: provideDragShadowMetrics

import android.graphics.Point; //導入方法依賴的package包/類
public void provideDragShadowMetrics(Point size, Point touch) {
    size.set((int)(mBitmap.getWidth() * getScaleX()), (int)(mBitmap.getHeight() * getScaleY()));

    final float xGrowth = mBitmap.getWidth() * (getScaleX() - 1);
    final float yGrowth = mBitmap.getHeight() * (getScaleY() - 1);
    touch.set(
            mRegistrationX + (int)Math.round(xGrowth / 2),
            mRegistrationY + (int)Math.round(yGrowth / 2));
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:10,代碼來源:DragView.java

示例12: resolveRelativeTouchPosition

import android.graphics.Point; //導入方法依賴的package包/類
private Point resolveRelativeTouchPosition(MotionEvent motionEvent) {
    if (locationOnScreen == null) {
        locationOnScreen = new int[2];
        touchPosition = new Point();
    }
    getLocationOnScreen(locationOnScreen);
    touchPosition.set(
            ((int) motionEvent.getRawX()) - locationOnScreen[0],
            ((int) motionEvent.getRawY()) - locationOnScreen[1]);
    return touchPosition;
}
 
開發者ID:xinpianchang,項目名稱:NSMPlayer-Android,代碼行數:12,代碼來源:VMovierTimeBar.java

示例13: setupLine

import android.graphics.Point; //導入方法依賴的package包/類
/**
 * 初始化曲線數據
 */
private void setupLine() {
    if (dataList.isEmpty()) return;

    int stepTemp = getTableStart();
    Point pre = new Point();
    pre.set(stepTemp, -getValueHeight(dataList.get(0).getValue()));//坐標係從0,0默認在第四象限繪製
    linePoints[0] = pre;
    linePath.moveTo(pre.x, pre.y);

    if (dataList.size() == 1) {
        isInitialized = true;
        return;
    }

    for (int i = 1; i < dataList.size(); i++) {
        Data data = dataList.get(i);
        Point next = new Point();
        next.set(stepTemp += stepSpace, -getValueHeight(data.getValue()));

        if (isBezierLine) {
            int cW = pre.x + stepSpace / 2;

            Point p1 = new Point();//控製點1
            p1.set(cW, pre.y);

            Point p2 = new Point();//控製點2
            p2.set(cW, next.y);

            linePath.cubicTo(p1.x, p1.y, p2.x, p2.y, next.x, next.y);//創建三階貝塞爾曲線
        } else {
            linePath.lineTo(next.x, next.y);
        }

        pre = next;
        linePoints[i] = next;
    }

    isInitialized = true;
}
 
開發者ID:jeanboydev,項目名稱:Android-LineChart,代碼行數:43,代碼來源:LineChartView.java

示例14: getDisplaySize

import android.graphics.Point; //導入方法依賴的package包/類
private Point getDisplaySize() {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = windowManager.getDefaultDisplay();
    Point point = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        display.getSize(point);
    } else {
        point.set(display.getWidth(), display.getHeight());
    }
    return point;
}
 
開發者ID:yangchong211,項目名稱:YCGallery,代碼行數:12,代碼來源:GalleryImageView.java

示例15: shiftViewCenter

import android.graphics.Point; //導入方法依賴的package包/類
@Override
public void shiftViewCenter(Direction direction, int shiftAmount, Point outCenter) {
    int newX = outCenter.x + direction.applyTo(shiftAmount);
    outCenter.set(newX, outCenter.y);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:Orientation.java


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