I have a TextView. I want to set its background color. But the color fills more top space than it does bottom space.
<!-- red background. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:background="#f00"
android:text="10.0" />
This is how it renders (zoomed in to demonstrate, green lines added by me):
So the extra space up top makes it look like the text is not centered within its own container. Is this expected? I'd like the text to appear vertically centered within its own container (the red area).
This is on a galaxy nexus, stock version of jellybean.
Thanks
Add the following attribute:
android:includeFontPadding="false"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With