TextView lineSpacingMultiplier小于零,最后一行

par*_*ath 12 android android-layout

我有一个TextView,我希望行间距小于1.0,即将小于行之间的默认空间量.我这样做了:

  <TextView
    android:id="@+id/text_header"
    android:layout_width="@dimen/text_header_width"
    android:layout_height="wrap_content"
    android:text="@string/header_text"
    android:textSize="@dimen/text_header_text_size"
    android:typeface="helvetica"
    android:lineSpacingMultiplier="0.95" />
Run Code Online (Sandbox Code Playgroud)

但是在底线的文字中,下降器(例如y,g和p)正在略微被切断.换句话说,这些字母的底部缺少大约2或3个像素.

我试过玩边距和填充没有成功.我似乎能够通过使用替代WRAP_CONTENT指定的高度(有一点额外的收入)来解决这个问题,但我想避免,如果可能的.

AIT*_*ANE -2

尝试这个

从你的代码使用textView.setLineSpacing()

或者

从你的xml使用android:lineSpacingExtra="xxdp"