android - Reduce ImageSpan height and width -


i'm setting image drawable spannablestring textview image comes out larger text making weird. need reduce size of imagespan such it's same height text:

here's i've tried:

drawable.setbounds(0, 0, drawable.getintrinsicwidth(), drawable.getintrinsicheight());  spannablestringbuilder builder = new spannablestringbuilder(holder.temptext.gettext()); builder.setspan(new imagespan(drawable), selectioncursor - ":)".length(), selectioncursor, spannable.span_exclusive_exclusive); holder.temptext.settext(builder); holder.temptext.setselection(selectioncursor);  holder.caption.settext(builder); 

you need measure textview's height , use instead of intrinsic bounds:

int lineheight = holder.temptext.getlineheight();  drawable.setbounds(0, 0, lineheight, lineheight); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -