Example usage for android.view View setPadding

List of usage examples for android.view View setPadding

Introduction

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

Prototype

public void setPadding(int left, int top, int right, int bottom) 

Source Link

Document

Sets the padding.

Usage

From source file:Main.java

public static void setPaddingAll(View v, int paddingInDp) {
    v.setPadding(dpToPx(v.getContext(), paddingInDp), dpToPx(v.getContext(), paddingInDp),
            dpToPx(v.getContext(), paddingInDp), dpToPx(v.getContext(), paddingInDp));

}

From source file:Main.java

public static void showAnimatedView(View view) {
    if (PRE_HC && view != null)
        view.setPadding(0, 0, 0, 0);
}

From source file:Main.java

public static void hideAnimatedView(View view) {
    if (PRE_HC && view != null)
        view.setPadding(view.getWidth(), 0, 0, 0);
}

From source file:Main.java

public static void setPadding(final View view, float left, float top, float right, float bottom) {
    view.setPadding(designedDP2px(left), dp2px(top), designedDP2px(right), dp2px(bottom));
}

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 {/*from w ww .j  a  va 2 s. co  m*/
        view.setPadding(padding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
    }
}

From source file:Main.java

public static void setPadding(Context context, View view, int leftDpValue, int topDpValue, int rightDpValue,
        int bottomDpValue) {
    view.setPadding(dp2px(context, leftDpValue), dp2px(context, topDpValue), dp2px(context, rightDpValue),
            dp2px(context, bottomDpValue));
}

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());
    }/* ww w.jav  a2 s. c om*/
}

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);
    }/* w  w  w .jav a2s  . c  o  m*/
}

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;
        }/* www .ja  v  a  2  s . c  o  m*/
    }
}

From source file:com.android.inputmethod.compat.ViewCompatUtils.java

public static void setPaddingRelative(final View view, final int start, final int top, final int end,
        final int bottom) {
    if (METHOD_setPaddingRelative == null) {
        view.setPadding(start, top, end, bottom);
        return;/*  w ww .j  ava 2  s .c o m*/
    }
    CompatUtils.invoke(view, null, METHOD_setPaddingRelative, start, top, end, bottom);
}