List of usage examples for android.view View getPaddingBottom
public int getPaddingBottom()
From source file:Main.java
public static void paddingForNavBar(View view) { if (isCanHaveTransparentDecor()) { int height = getNavBarHeight(view.getContext()); view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom() + height); }//ww w . j a v a2 s . co m }
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:Main.java
public static void paddingForStatusBar(View view, boolean isFixedSize) { if (isCanHaveTransparentDecor()) { int height = getStratusBarHeight(view.getContext()); view.setPadding(view.getPaddingLeft(), view.getPaddingTop() + height, view.getPaddingRight(), view.getPaddingBottom()); if (isFixedSize) { view.getLayoutParams().height += height; }/*ww w .j a v a 2s .co m*/ } }
From source file:com.agenmate.lollipop.util.ViewUtils.java
public static void setPaddingTop(View view, int paddingTop) { view.setPaddingRelative(view.getPaddingStart(), paddingTop, 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 setPaddingStart(View view, int paddingStart) { view.setPaddingRelative(paddingStart, view.getPaddingTop(), view.getPaddingEnd(), view.getPaddingBottom()); }
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);// w ww . j a v a 2 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.ja v a 2s . 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) * 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: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 v a 2 s . c o m 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:com.waz.zclient.utils.ViewUtils.java
public static void setPaddingLeftRight(View view, int padding) { view.setPadding(padding, view.getPaddingTop(), padding, view.getPaddingBottom()); }