I use custom fonts in my android TextView.
Typeface tf = Typeface.createFromAsset(getAssets(),
"nunitomedium.ttf");
txt2= (TextView) findViewById(R.id.txt2);
txt2.setTypeface(tf);
But the spacing between the lines is not displayed properly.
<TextView
android:id="@+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginRight="@dimen/_10sdp"
android:layout_marginTop="@dimen/_15sdp"
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="@color/colorBlack"
android:textSize="@dimen/_15sdp" />
Here is my conclusion:

I also tried with the following code:
android:includeFontPadding="false"
but still the same question. Not sure, but I also tried to use justifyTextViewfrom Here , but the same problem. Has anyone encountered the same problem before?
Thanks in advance.
EDIT:
If I use android:lineSpacingExtra, the first line has more space than the other lines. Here is my code and output.
<TextView
android:id="@+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginRight="@dimen/_10sdp"
android:layout_marginTop="@dimen/_15sdp"
android:lineSpacingExtra="@dimen/_5sdp" <<<<<<<
android:text="You can send emergency blast to friends and family whenever you feel uncomfortable. Once activated, you will be able to send an emergency blast to your safety network within seconds with the pressing of one button."
android:textColor="@color/colorBlack"
android:textSize="@dimen/_15sdp" />

source
share