textview - Android Custom text View To hold images and text -
i have show text , images textview holds. spannable object can used problem images being downloaded server @ run time , have display placeholder till images downloaded..
so thinking of creating custom textview extends viewgroup there lot of handling. let me know if there best option available because have shortage of time
this can achieved using spannablestring
, imagespan
classes. instance of spannablestring
can created , can set teaxtview
.
instance of spannablestring
can contain combination of text , image. here quick example find:
public class testactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); textview textview = (textview) findviewbyid(r.id.textview); spannablestring ss = new spannablestring("abc"); drawable d = getresources().getdrawable(r.drawable.icon32); d.setbounds(0, 0, d.getintrinsicwidth(), d.getintrinsicheight()); imagespan span = new imagespan(d, imagespan.align_baseline); ss.setspan(span, 0, 3, spannable.span_inclusive_exclusive); textview.settext(ss); }
have @ link well
Comments
Post a Comment