List of usage examples for android.graphics Point Point
public Point()
From source file:Main.java
public static Point getCenter(View v) { Point point = new Point(); point.x = (int) (v.getX() + (v.getMeasuredWidth() / 2)); point.y = (int) (v.getY() + (v.getMeasuredHeight() / 2)); return point; }
From source file:Main.java
public static Point getNewSizeRatio(double w, int height, int width) { Point point = new Point(); double ratio = height; ratio /= width;/*from w w w .j a va2 s. co m*/ point.x = (int) w; point.y = (int) (w * ratio); return point; }
From source file:Main.java
public static Point getScreenSize(Activity context) { Point screenSize = new Point(); context.getWindowManager().getDefaultDisplay().getSize(screenSize); return screenSize; }
From source file:Main.java
public static Point getWindowSize(Display defaultDisplay) { Point windowSize = new Point(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) { defaultDisplay.getSize(windowSize); } else {//from w w w .j a v a 2 s . com windowSize.x = defaultDisplay.getWidth(); windowSize.y = defaultDisplay.getHeight(); } return windowSize; }
From source file:Main.java
public static Point getRealScreenSize(Activity activity) { Point result = new Point(); Display display = activity.getWindowManager().getDefaultDisplay(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { display.getRealSize(result);/* w ww. j a va2 s. c o m*/ } else { display.getSize(result); } return result; }
From source file:Main.java
public static Point getRealSize(Display display) { Point outPoint = new Point(); Method mGetRawH;//from ww w . j a v a 2 s .com try { mGetRawH = Display.class.getMethod("getRawHeight"); Method mGetRawW = Display.class.getMethod("getRawWidth"); outPoint.x = (Integer) mGetRawW.invoke(display); outPoint.y = (Integer) mGetRawH.invoke(display); return outPoint; } catch (Throwable e) { return null; } }
From source file:Main.java
public static Point getScreenSize(final Activity a) { Display display = a.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);// w w w . ja va2 s . co m return size; }
From source file:Main.java
public static int getWidthScreen(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);//ww w . ja v a 2 s.c om return size.x; }
From source file:Main.java
public static Point getScreenSize(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); size.set(display.getWidth(), display.getHeight()); return size;/* w w w .j a v a 2s . c o m*/ }
From source file:Main.java
public static int getDeviceWidth(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size);//from ww w.ja v a2 s .c o m return size.x; }