List of usage examples for android.view View getPaddingTop
public int getPaddingTop()
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.agenmate.lollipop.util.ViewUtils.java
public static void setPaddingStart(View view, int paddingStart) { view.setPaddingRelative(paddingStart, view.getPaddingTop(), view.getPaddingEnd(), view.getPaddingBottom()); }
From source file:com.agenmate.lollipop.util.ViewUtils.java
public static void setPaddingEnd(View view, int paddingEnd) { view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), paddingEnd, view.getPaddingBottom()); }
From source file:com.agenmate.lollipop.util.ViewUtils.java
public static void setPaddingBottom(View view, int paddingBottom) { view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), view.getPaddingEnd(), paddingBottom); }
From source file:com.google.samples.apps.ourstreets.view.ViewUtils.java
/** * Applies top window insets for a view. * * @param view The view to apply insets for. *//*from w w w .j a va 2 s . c om*/ public static void applyTopWindowInsetsForView(@NonNull final View view) { view.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { v.setPadding(v.getPaddingLeft(), insets.getSystemWindowInsetTop() + v.getPaddingTop(), v.getPaddingRight(), v.getPaddingBottom()); return insets; } }); view.requestApplyInsets(); }
From source file:Main.java
public static MotionEvent motionEventAtPosition(View view, int action, int position) { // NOTE: This method is not perfect. If you send touch events in a granular nature, you'll // see varying results of accuracy depending on the size of the jump. int paddingLeft = view.getPaddingLeft(); int paddingRight = view.getPaddingRight(); int paddingTop = view.getPaddingTop(); int paddingBottom = view.getPaddingBottom(); int width = view.getWidth(); int height = view.getHeight(); int topLeft[] = new int[2]; view.getLocationInWindow(topLeft);/*from w w w .j ava2 s . c o m*/ int x1 = topLeft[0] + paddingLeft; int y1 = topLeft[1] + paddingTop; int x2 = x1 + width - paddingLeft - paddingRight; int y2 = y1 + height - paddingTop - paddingBottom; float x = x1 + ((x2 - x1) * position / 100f); float y = y1 + ((y2 - y1) / 2f); long time = SystemClock.uptimeMillis(); return MotionEvent.obtain(time, time, action, x, y, 0); }
From source file:Main.java
public static MotionEvent motionEventAtPosition(View view, int action, int xPercent, int yPercent) { // NOTE: This method is not perfect. If you send touch events in a granular nature, you'll // see varying results of accuracy depending on the size of the jump. int paddingLeft = view.getPaddingLeft(); int paddingRight = view.getPaddingRight(); int paddingTop = view.getPaddingTop(); int paddingBottom = view.getPaddingBottom(); int width = view.getWidth(); int height = view.getHeight(); int[] topLeft = new int[2]; view.getLocationInWindow(topLeft);//from w w w . j a v a2 s . c om int x1 = topLeft[0] + paddingLeft; int y1 = topLeft[1] + paddingTop; int x2 = x1 + width - paddingLeft - paddingRight; int y2 = y1 + height - paddingTop - paddingBottom; float x = x1 + ((x2 - x1) * xPercent / 100f); float y = y1 + ((y2 - y1) * yPercent / 100f); long time = SystemClock.uptimeMillis(); return MotionEvent.obtain(time, time, action, x, y, 0); }
From source file:Main.java
/** * /* w w w. j av a2s. co m*/ * @param context * @param view * @param resid * @return */ public static View addBackgroundIndicator(Context context, View view, int resid) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { TypedArray attributes = context.obtainStyledAttributes(new int[] { resid }); int resource = attributes.getResourceId(0, 0); attributes.recycle(); // setBackgroundResource resets padding int paddingLeft = view.getPaddingLeft(); int paddingTop = view.getPaddingTop(); int paddingRight = view.getPaddingRight(); int paddingBottom = view.getPaddingBottom(); view.setBackgroundResource(resource); view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); } return view; }
From source file:com.waz.zclient.utils.ViewUtils.java
public static void setPaddingLeftRight(View view, int padding) { view.setPadding(padding, view.getPaddingTop(), padding, view.getPaddingBottom()); }
From source file:com.waz.zclient.utils.ViewUtils.java
public static void setPaddingLeft(View view, int leftPadding) { view.setPadding(leftPadding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); }