java - How to add bottom padding to span content of textView within RelativeLayout programmatically -
how can padding added bottom of textview programmatically? noticed there padding above text not below. can done in order add black padding @ bottom @ top? make text view lot more legible (especially letters extend below baseline i.e. g
, y
).
textview tv1 = v.findviewbyid(r.id.textview1); string mystring = " " + getstring(r.string.magnify) + " "; spannable spanna = new spannablestring(mystring); spanna.setspan(new backgroundcolorspan(color.black), 0, mystring.length(), spannable.span_exclusive_exclusive); spanna.setspan(new foregroundcolorspan(contextcompat.getcolor(getcontext(), r.color.yellow)), 0, mystring.length(), spannable.span_exclusive_exclusive); tv2.settext(spanna);
you can use: yourtextview.setpadding(0, 10, 0, 0); android - how set padding textview in listview or expandablelistview
or increase textviewheight , centre text.
Comments
Post a Comment