List of usage examples for android.text.style ImageSpan getDrawable
@Override
public Drawable getDrawable()
From source file:Main.java
public static CharSequence addIcon(CharSequence total, BitmapDrawable bitmapDrawable, int height) { SpannableString string = new SpannableString(" "); ImageSpan imageSpan = new ImageSpan(bitmapDrawable); int width = (int) (height / (bitmapDrawable.getIntrinsicHeight() / (float) bitmapDrawable.getIntrinsicWidth())); imageSpan.getDrawable().setBounds(0, 0, width, height); string.setSpan(imageSpan, 0, 1, 0);//w w w .jav a2 s .c o m if (total == null) { return string; } else { return TextUtils.concat(total, string); } }
From source file:com.forrestguice.suntimeswidget.SuntimesUtils.java
public static ImageSpan createImageSpan(ImageSpan other) { Drawable drawable = null;/*www .ja va 2 s . c o m*/ if (other != null) drawable = other.getDrawable(); return new ImageSpan(drawable); }