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
Post a Comment