line one and line two are different TextViews
separated with a 8dp margin vertically
line three and four is one TextView
that uses a SpannableString
.
Is there a way i can add the same spacing(8dp) with a Span?
I tried using a LineHeightSpan
, the result is the image below.
append("line three")
appendLine()
appendLine()
setSpan(
LineHeightSpan.Standard((8 * resources.displayMetrics.density).toInt()),
0,
length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
append("line four")