List of usage examples for android.graphics.drawable Drawable setBounds
public void setBounds(int left, int top, int right, int bottom)
From source file:Main.java
public static void boundCenterBottom(Drawable drawable) { drawable.setBounds(drawable.getIntrinsicWidth() / -2, -drawable.getIntrinsicHeight(), drawable.getIntrinsicWidth() / 2, 0); }
From source file:Main.java
public static void boundCenter(Drawable drawable) { drawable.setBounds(drawable.getIntrinsicWidth() / -2, drawable.getIntrinsicHeight() / -2, drawable.getIntrinsicWidth() / 2, drawable.getIntrinsicHeight() / 2); }
From source file:Main.java
/** * Resizes an icon drawable to the correct icon size. *///from w w w. j a v a 2 s . co m static void resizeIconDrawable(Drawable icon) { icon.setBounds(0, 0, sIconTextureWidth, sIconTextureHeight); }
From source file:Main.java
public static Drawable getDrawable(@Nullable Context context, @Nullable int id) { Drawable draw = context.getResources().getDrawable(id); draw.setBounds(0, 0, draw.getMinimumWidth(), draw.getMinimumHeight()); return draw;//from w w w. ja v a2 s . c o m }
From source file:Main.java
public static Drawable getDrawable(Context context, int R_ID) { Drawable brawable = context.getResources().getDrawable(R_ID); brawable.setBounds(0, 0, brawable.getMinimumWidth(), brawable.getMinimumHeight()); return brawable; }
From source file:Main.java
public static Drawable getCompoundDrawable(@NonNull Context context, @DrawableRes int resId) { Drawable drawable = context.getResources().getDrawable(resId); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); return drawable; }
From source file:Main.java
public static void textViewSetImg(Context context, TextView tv, int resId) { Drawable drawable = context.getResources().getDrawable(resId); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); tv.setCompoundDrawables(drawable, null, null, null); }
From source file:Main.java
@SuppressWarnings("deprecation") public static void setTvLeftPic(Context context, int resId, TextView tv) { Drawable drawable = context.getResources().getDrawable(resId); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); tv.setCompoundDrawables(drawable, null, null, null); }
From source file:Main.java
public static CharSequence addImageToText(Context context, CharSequence text, int resID, int start, int end) { SpannableStringBuilder builder = new SpannableStringBuilder(text); Drawable d = context.getResources().getDrawable(resID); d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); builder.setSpan(span, text.length(), 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE); return builder; }
From source file:Main.java
public static ImageGetter getImageGetter(final Context c) { return new ImageGetter() { public Drawable getDrawable(String source) { Integer resID = c.getResources().getIdentifier(source, "drawable", c.getPackageName()); Drawable d = c.getResources().getDrawable(resID); d.setBounds(0, 0, 24, 24); return d; }/* www. j a va 2s .c o m*/ }; }