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).

enter image description here

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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -