List of usage examples for android.widget TextView setCompoundDrawablesWithIntrinsicBounds
@android.view.RemotableViewMethod public void setCompoundDrawablesWithIntrinsicBounds(@Nullable Drawable left, @Nullable Drawable top, @Nullable Drawable right, @Nullable Drawable bottom)
From source file:Main.java
public static void addBadge(TextView tv, Drawable d) { Drawable[] dws = tv.getCompoundDrawables(); dws[2] = d;// w ww . j a va2 s. com tv.setCompoundDrawablesWithIntrinsicBounds(dws[0], dws[1], dws[2], dws[3]); }
From source file:Main.java
public static boolean setTextCompoundDrawableWithCatchOOM(TextView tv, int left, int top, int right, int bottom) { if (tv == null) return false; try {/*ww w . ja v a 2 s .c o m*/ tv.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom); return true; } catch (OutOfMemoryError e) { return false; } }
From source file:nl.sebastiaanschool.contact.app.gui.GrabBag.java
public static void applyBitmapDrawableLeft(TextView view, @DrawableRes int resId) { // This could be defined in XML just as easily, but it's here for symmetry at the call site. view.setCompoundDrawablesWithIntrinsicBounds(resId, 0, 0, 0); }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void removeTextViewDrawable(TextView tv) { tv.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void setTextViewDrawable(TextView tv, Drawable d) { tv.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null); tv.setCompoundDrawablePadding(UiUtils.convertDpToPx(tv.getContext(), 6)); }
From source file:Main.java
/** * @see android.widget.TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, * int)/*from ww w . j a v a 2 s . c o m*/ */ public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, int start, int top, int end, int bottom) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { textView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, bottom, end); } else { textView.setCompoundDrawablesWithIntrinsicBounds(start, top, bottom, end); } }
From source file:Main.java
/** * @see android.widget.TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable, * Drawable, Drawable, Drawable)/*from ww w . ja va2s . c om*/ */ public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable start, Drawable top, Drawable end, Drawable bottom) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { textView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, bottom, end); } else { textView.setCompoundDrawablesWithIntrinsicBounds(start, top, bottom, end); } }
From source file:Main.java
/** * @see android.widget.TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(int, int, int, * int)/*from w w w . j av a2 s. com*/ */ public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, int start, int top, int end, int bottom) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { // Work around the platform bug described in setCompoundDrawablesRelative() above. boolean isRtl = isLayoutRtl(textView); textView.setCompoundDrawablesWithIntrinsicBounds(isRtl ? end : start, top, isRtl ? start : end, bottom); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) { textView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom); } else { textView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom); } }
From source file:Main.java
/** * @see android.widget.TextView#setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable, * Drawable, Drawable, Drawable)/*from w w w .j a va 2 s . c o m*/ */ public static void setCompoundDrawablesRelativeWithIntrinsicBounds(TextView textView, Drawable start, Drawable top, Drawable end, Drawable bottom) { if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) { // Work around the platform bug described in setCompoundDrawablesRelative() above. boolean isRtl = isLayoutRtl(textView); textView.setCompoundDrawablesWithIntrinsicBounds(isRtl ? end : start, top, isRtl ? start : end, bottom); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR1) { textView.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom); } else { textView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom); } }
From source file:com.doctoror.fuckoffmusicplayer.presentation.util.BindingAdapters.java
@BindingAdapter({ "drawableTop", "tintAttr" }) public static void setDrawableTopTintedFromAttr(@NonNull final TextView textView, @Nullable Drawable top, @AttrRes final int tintAttr) { final Drawable[] drawables = textView.getCompoundDrawables(); if (top != null) { top = DrawableUtils.getTintedDrawableFromAttrTint(textView.getContext(), top, tintAttr); }//from w w w.j ava2s .c om textView.setCompoundDrawablesWithIntrinsicBounds(drawables[0], top, drawables[2], drawables[3]); }