Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set line-height textView on Android

Tags:

android

I give below attributes that I use textView in my application. ( Green text in middle )

<TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textSize="20sp"
                android:textStyle="bold"
                android:gravity="center_horizontal"
                android:text="10/9"
                android:id="@+id/estimate_fertility_date"
                />

However, there are spaces like the example picture. I want to set these spaces because when App initialize, It seems awful.

I have researched about 1 hour and I found some answers but They are not which I want answers. https://stackoverflow.com/a/6864017/2834196

enter image description here

like image 223
Olkunmustafa Avatar asked Dec 29 '14 15:12

Olkunmustafa


1 Answers

It 's not easy to get absolutely no text padding in a normal TextView. One way is to can set a minus margin for the TextView, or just use textview.setIncludeFontPadding(false) to reduce padding to some degree.

like image 82
Eager3466 Avatar answered Nov 07 '22 17:11

Eager3466