List of usage examples for android.view View getPaddingRight
public int getPaddingRight()
From source file:Main.java
public static void setBackgroundResource(final View v, final int resource) { final int padLeft = v.getPaddingLeft(); final int padRight = v.getPaddingRight(); final int padTop = v.getPaddingRight(); final int padBottom = v.getPaddingBottom(); v.setBackgroundResource(resource);/*from w w w.j a va 2s . c om*/ v.setPadding(padLeft, padTop, padRight, padBottom); }
From source file:Main.java
static int getPaddingHorizontally(View v) { if (v == null) { return 0; }/*www . j ava 2s . c om*/ return v.getPaddingLeft() + v.getPaddingRight(); }
From source file:Main.java
public static void measureDynamicHeight(View view) { int width = view.getWidth(); if (width <= 0) { View parent = (View) view.getParent(); width = parent.getWidth() - parent.getPaddingLeft() - parent.getPaddingRight(); }/*from ww w. j a v a2s . c om*/ int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY); int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); view.measure(widthMeasureSpec, heightMeasureSpec); }
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
public static void setFixedDrableBg(View v, int drawAbRes) { int bottom = v.getPaddingBottom(); int top = v.getPaddingTop(); int right = v.getPaddingRight(); int left = v.getPaddingLeft(); v.setBackgroundResource(drawAbRes);//from w w w.j av a 2s.c o m v.setPadding(left, top, right, bottom); }
From source file:Main.java
public static int[] getViewSizeFromSpec(View view, int widthSpec, int heightSpec) { int minWidth = View.MeasureSpec.getSize(widthSpec) + view.getPaddingLeft() + view.getPaddingRight(); int width = ViewCompat.resolveSizeAndState(minWidth, widthSpec, 1); int minHeight = View.MeasureSpec.getSize(heightSpec) + view.getPaddingBottom() + view.getPaddingTop(); int height = ViewCompat.resolveSizeAndState(minHeight, heightSpec, 0); return new int[] { width, height }; }
From source file:com.android.inputmethod.compat.ViewCompatUtils.java
public static int getPaddingEnd(final View view) { if (METHOD_getPaddingEnd == null) { return view.getPaddingRight(); }/*from w w w. ja v a 2 s. c om*/ return (Integer) CompatUtils.invoke(view, 0, METHOD_getPaddingEnd); }
From source file:com.gemapps.saidit.util.ViewUtil.java
/** * Set a new top padding/*w ww. j a v a 2 s .c om*/ * * @param view The view to set the new top padding * @param paddingTop The new padding value */ public static void setPaddingTop(View view, int paddingTop) { ViewCompat.setPaddingRelative(view, view.getPaddingLeft(), paddingTop, view.getPaddingRight(), view.getPaddingBottom()); }
From source file:Main.java
public static void setBackgroundKeepingPadding(View view, Drawable drawable) { int top = view.getPaddingTop(); int left = view.getPaddingLeft(); int right = view.getPaddingRight(); int bottom = view.getPaddingBottom(); setBackground(view, drawable);//from w w w . j av a 2 s .c o m view.setPadding(left, top, right, bottom); }
From source file:Main.java
/** * Sets the background of a view to the given 9-patch resource and restores its padding. This * works around a bug in Android where the padding is lost when a 9-patch resource is applied * programmatically.//from w ww . ja v a2 s .co m */ public static void setNinePatchBackgroundResource(View view, @DrawableRes int resource) { int left = view.getPaddingLeft(); int top = view.getPaddingTop(); int right = view.getPaddingRight(); int bottom = view.getPaddingBottom(); view.setBackgroundResource(resource); view.setPadding(left, top, right, bottom); }