List of usage examples for android.view View getMeasuredWidth
public final int getMeasuredWidth()
From source file:Main.java
public static int getViewWidth(View context) { return context.getMeasuredWidth(); }
From source file:Main.java
static int getMeasuredWidth(View v) { return (v == null) ? 0 : v.getMeasuredWidth(); }
From source file:Main.java
public static int getViewMeasuredWidth(View view) { calcViewMeasure(view); return view.getMeasuredWidth(); }
From source file:Main.java
/** * Returns a bitmap showing a screenshot of the view passed in. *//*from w ww .j a v a 2 s. c o m*/ @NonNull static Bitmap getBitmapFromView(final View v) { Bitmap bitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas); return bitmap; }
From source file:com.actionbarsherlock.internal.widget.IcsView.java
/** * Return only the state bits of {@link #getMeasuredWidthAndState()} * and {@link #getMeasuredHeightAndState()}, combined into one integer. * The width component is in the regular bits {@link #MEASURED_STATE_MASK} * and the height component is at the shifted bits * {@link #MEASURED_HEIGHT_STATE_SHIFT}>>{@link #MEASURED_STATE_MASK}. *//*from w w w.j ava 2 s. com*/ public static int getMeasuredStateInt(View child) { return (child.getMeasuredWidth() & View.MEASURED_STATE_MASK) | ((child.getMeasuredHeight() >> View.MEASURED_HEIGHT_STATE_SHIFT) & (View.MEASURED_STATE_MASK >> View.MEASURED_HEIGHT_STATE_SHIFT)); }
From source file:Main.java
public static int getMeasuredWidth(View view) { measureView(view); return view.getMeasuredWidth(); }
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 int getViewWidth(View view) { if (view != null) { int width = view.getMeasuredWidth(); if (width == 0) { LayoutParams params = view.getLayoutParams(); if (params != null && params.width > 0) { return params.width; }//from w w w. j a va2 s . c o m view.measure(0, 0); width = view.getMeasuredWidth(); } return width; } return 0; }
From source file:Main.java
public static int getViewWidth(View view) { measureView(view); return view.getMeasuredWidth(); }
From source file:Main.java
/** * Returns a bitmap showing a screenshot of the view passed in. *//*from ww w .ja v a 2 s .co m*/ @NonNull static Bitmap getBitmapFromView(@NonNull final View v) { Bitmap bitmap = Bitmap.createBitmap(v.getMeasuredWidth(), v.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); v.draw(canvas); return bitmap; }