List of usage examples for android.view View getLeft
@ViewDebug.CapturedViewProperty public final int getLeft()
From source file:Main.java
static public Rect getFrame(View v) { return new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom()); }
From source file:Main.java
static public Rect getPaddedFrame(View v) { return new Rect(v.getLeft() + v.getPaddingLeft(), v.getTop() + v.getPaddingTop(), v.getRight() - v.getPaddingRight(), v.getBottom() - v.getPaddingBottom()); }
From source file:Main.java
static public PointF getPosition(View v) { return new PointF(v.getLeft(), v.getTop()); }
From source file:Main.java
public static float getDistanceToCenterX(View target) { float viewCenter = target.getLeft() + target.getWidth() / 2f; float rootCenter = ((View) target.getParent()).getWidth() / 2; return target.getWidth() / 2f + rootCenter - viewCenter; }
From source file:Main.java
public static float getViewX(View view) { return Math.abs((view.getRight() - view.getLeft()) / 2); }
From source file:Main.java
public static int getRelativeLeft(View myView) { if (myView.getId() == android.R.id.content) return myView.getLeft(); else//from w w w . j av a 2 s . c o m return myView.getLeft() + getRelativeLeft((View) myView.getParent()); }
From source file:Main.java
public static void drawTop(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int left = child.getLeft() - params.leftMargin - drawable.getIntrinsicWidth(); final int right = child.getRight() + params.rightMargin + drawable.getIntrinsicWidth(); final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = top + drawable.getIntrinsicHeight(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas);/* w w w .j a va 2 s . c o m*/ }
From source file:Main.java
public static void invalidateGlobalRegion(View view) { invalidateGlobalRegion(view, new RectF(view.getLeft(), view.getTop(), view.getRight(), view.getBottom())); }
From source file:Main.java
public static void drawTopAlignItem(Canvas canvas, Drawable drawable, View child, ViewGroup.MarginLayoutParams params) { final int left = child.getLeft() - params.leftMargin; final int right = child.getRight() + params.rightMargin; final int top = child.getTop() - params.topMargin - drawable.getIntrinsicHeight(); final int bottom = top + drawable.getIntrinsicHeight(); drawable.setBounds(left, top, right, bottom); drawable.draw(canvas);/* ww w .j a v a2s . c o m*/ }
From source file:Main.java
public static boolean pointInView(View view, float localX, float localY) { return localX >= 0 && localX < (view.getRight() - view.getLeft()) && localY >= 0 && localY < (view.getBottom() - view.getTop()); }