List of usage examples for android.view View getHeight
@ViewDebug.ExportedProperty(category = "layout") public final int getHeight()
From source file:Main.java
public static Bundle getScaleBundle(View view) { return ActivityOptionsCompat.makeScaleUpAnimation(view, 0, 0, view.getWidth(), view.getHeight()).toBundle(); }
From source file:Main.java
public static Bitmap getBitmapFromView(View view) { Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(returnedBitmap); Drawable bgDrawable = view.getBackground(); if (bgDrawable != null) bgDrawable.draw(canvas);//w w w.java 2 s. c o m else canvas.drawColor(Color.WHITE); view.draw(canvas); return returnedBitmap; }
From source file:Main.java
/** * Honeycomb IMPL borrowed from android.support.design.widget.ViewGroupUtils and * android.support.design.widget.ViewGroupUtilsHoneycomb *//* ww w .ja va2s .c o m*/ public static void getDescendantRect(ViewGroup parent, View descendant, Rect out) { out.set(0, 0, descendant.getWidth(), descendant.getHeight()); offsetDescendantRect(parent, descendant, out); }
From source file:Main.java
static Bitmap convertViewToBitmap(View view) { view.clearFocus();//from w w w . j ava 2 s . co m Bitmap bitmap = createBitmapSafely(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_4444, 2); if (bitmap != null) { mCanvas.setBitmap(bitmap); mCanvas.translate(-view.getScrollX(), -view.getScrollY()); view.draw(mCanvas); mCanvas.setBitmap(null); } return bitmap; }
From source file:Main.java
public static Animator createInAnimator(View view) { // get the center for the clipping circle int cx = view.getWidth() / 2; int cy = view.getHeight() / 2; // get the final radius for the clipping circle int finalRadius = Math.max(view.getWidth(), view.getHeight()); // create the animator for this view (the start radius is zero) return ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius).setDuration(300); }
From source file:Main.java
public static Animator createOutAnimator(View view) { // get the center for the clipping circle int cx = view.getWidth() / 2; int cy = view.getHeight() / 2; // get the initial radius for the clipping circle int initialRadius = view.getWidth(); // create the animation (the final radius is zero) return ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0).setDuration(300); }
From source file:Main.java
public static double[] convertBitmapXYintoViewXY(View view, Bitmap bitmap, double BitmapPixelX, double BitmapPixelY) { double imgHeight = view.getHeight(); double imgWidth = view.getWidth(); double bmHeight = bitmap.getHeight(); double bmWidth = bitmap.getWidth(); double WidthRatio = imgWidth / bmWidth; double HeightRatio = imgHeight / bmHeight; double x = BitmapPixelX * WidthRatio; double y = BitmapPixelY * HeightRatio; double[] bitmapXY = new double[] { x, y }; return bitmapXY; }
From source file:Main.java
/** * Post translates the matrix to center the given bounds inside the view. *///from www . j ava2s. co m public static void postCenterMatrix(RectF contentBounds, View view, Matrix matrix) { matrix.postTranslate((view.getWidth() - contentBounds.width()) / 2, (view.getHeight() - contentBounds.height()) / 2); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static Animator createHideAnim(final View viewRoot, int x, int y) { float initialRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override//from w ww . j a va 2s . c o m public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); viewRoot.setVisibility(View.GONE); } }); anim.start(); return anim; }
From source file:Main.java
public static Bitmap takeScreenShot(View view) { if (null == view) { return null; }/*ww w . jav a 2 s .com*/ assert view.getWidth() > 0 && view.getHeight() > 0; Bitmap.Config config = Bitmap.Config.ARGB_8888; Bitmap bitmap = null; try { bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), config); Canvas canvas = new Canvas(bitmap); view.draw(canvas); } catch (OutOfMemoryError e) { e.printStackTrace(); } return bitmap; }