How can padding be added to the bottom of the textview programmatically? I noticed that there is some padding above the text but not below. What can be done in order to add some black padding at the bottom just like at the top? It would make the text view a lot more legible (especially for letters that extend below the baseline i.e. g
and 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);