Skip to content Skip to sidebar Skip to footer

How To Load Image In Textview?

I want to display image in textview,is it possible?anybody knows,please give sample code for me.. Thanks All

Solution 1:

you can use

SpannableStringss=newSpannableString("abc");
    Drawabled= img.getDrawable();
    d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
    ImageSpanspan=newImageSpan(d, ImageSpan.ALIGN_BASELINE);
    ss.setSpan(span, 0, 3, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
    et.setText(ss);

Solution 2:

tv.setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom);

Post a Comment for "How To Load Image In Textview?"