List of usage examples for android.view View getPaddingRight
public int getPaddingRight()
From source file:Main.java
public static void makeListItemClickable(View listItem, OnClickListener onRowClick) { listItem.setClickable(true);//w w w. ja v a2 s . co m listItem.setFocusable(true); // setBackgroundResource seems to reset padding... // http://stackoverflow.com/questions/5890379/android-setbackgroundresource-discards-my-xml-layout-attributes // so manually save and restore them int padLeft = listItem.getPaddingLeft(); int padRight = listItem.getPaddingRight(); int padTop = listItem.getPaddingTop(); int padBottom = listItem.getPaddingBottom(); listItem.setBackgroundResource(android.R.drawable.menuitem_background); listItem.setPadding(padLeft, padTop, padRight, padBottom); listItem.setOnClickListener(onRowClick); }
From source file:android.support.design.internal.SnackbarContentLayout.java
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else {/*from ww w .jav a2 s . c om*/ view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } }
From source file:Main.java
/** * /* w w w . j a va 2 s . 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 setPaddingTop(View view, int topPadding) { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), 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()); }
From source file:Main.java
static void changeViewLeftPadding(final View view, int fromMargin, int toMargin) { ValueAnimator animator = ValueAnimator.ofFloat(fromMargin, toMargin); animator.setDuration(3000);//from ww w . ja va2 s. c o m animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setPadding((int) animatedValue, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); view.requestLayout(); } }); animator.start(); }
From source file:Main.java
static void changeViewTopPadding(final View view, int fromPadding, int toPadding) { ValueAnimator animator = ValueAnimator.ofFloat(fromPadding, toPadding); animator.setDuration(150);/* w ww . jav a 2s. com*/ animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setPadding(view.getPaddingLeft(), (int) animatedValue, view.getPaddingRight(), view.getPaddingBottom()); } }); animator.start(); }
From source file:com.waz.zclient.utils.ViewUtils.java
public static void setPaddingBottom(View view, int bottomPadding) { view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), bottomPadding); }
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
public static void setViewBackground(View view, Drawable bg) { int paddingL = view.getPaddingLeft(); int paddingT = view.getPaddingTop(); int paddingR = view.getPaddingRight(); int paddingB = view.getPaddingBottom(); if (isApi_16_OrHigher()) { view.setBackground(bg);/*from w w w . j a va2 s .c o m*/ } else { //noinspection deprecation view.setBackgroundDrawable(bg); } view.setPadding(paddingL, paddingT, paddingR, paddingB); }
From source file:com.desmond.ripple.view.RippleCompat.java
private static void adaptBackground(RippleCompatDrawable rippleDrawable, View v, RippleConfig config) { Drawable background;/* w ww .ja va 2 s . co m*/ if (v instanceof ImageView) { ImageView.ScaleType scaleType = ((ImageView) v).getScaleType(); background = ((ImageView) v).getDrawable(); rippleDrawable.setBackgroundDrawable(background).setScaleType(scaleType).setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), v.getPaddingBottom()); ((ImageView) v).setImageDrawable(null); setBackground(v, rippleDrawable); } else { if (config.getBackgroundDrawable() != null) { rippleDrawable.setBackgroundDrawable(config.getBackgroundDrawable()); rippleDrawable.setScaleType(config.getScaleType()); } background = v.getBackground(); if (background != null) { setBackground(v, new LayerDrawable(new Drawable[] { background, rippleDrawable })); } else { setBackground(v, rippleDrawable); } } }