Example usage for android.view View getPaddingBottom

List of usage examples for android.view View getPaddingBottom

Introduction

In this page you can find the example usage for android.view View getPaddingBottom.

Prototype

public int getPaddingBottom() 

Source Link

Document

Returns the bottom padding of this view.

Usage

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. ja  v a2 s  . c  om*/
    v.setPadding(left, top, right, bottom);
}

From source file:Main.java

public static void setViewBackgroundWithoutResettingPadding(final View v, final int backgroundResId) {
    final int paddingBottom = v.getPaddingBottom(), paddingLeft = v.getPaddingLeft();
    final int paddingRight = v.getPaddingRight(), paddingTop = v.getPaddingTop();
    v.setBackgroundResource(backgroundResId);
    v.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
}

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 setStartPadding(final Context context, View view, int padding) {
    if (isRtl(context)) {
        view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), padding, view.getPaddingBottom());
    } else {//ww  w .j  a  v a2  s.  c om
        view.setPadding(padding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
    }
}

From source file:com.gemapps.saidit.util.ViewUtil.java

/**
 * Set a new top padding/*w  w w.  jav a  2 s .com*/
 *
 * @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 om*/
    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 ww w.  j av  a2s . c om
 */
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);
}

From source file:com.justplay1.shoppist.utils.ViewUtils.java

public static void setPaddingRight(View view, int padding) {
    view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), padding, view.getPaddingBottom());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(view.getPaddingStart(), view.getPaddingTop(), padding, view.getPaddingBottom());
    }//  w  ww. jav  a  2s  . c  om
}

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);// w w  w .  j  a  v a2  s.  c  o  m
    v.setPadding(padLeft, padTop, padRight, padBottom);
}

From source file:Main.java

public static void setBackground(View view, int background) {
    if (view == null) {
        return;/*  w w  w. j ava 2 s. c o  m*/
    }
    int left = view.getPaddingLeft();
    int right = view.getPaddingRight();
    int top = view.getPaddingTop();
    int bottom = view.getPaddingBottom();
    view.setBackgroundResource(background);
    view.setPadding(left, top, right, bottom);
}