Answers for "android paint drawtext multiline"

0

android paint drawtext multiline

// Kotlin language
val fm = paint.fontMetrics
val lineHeight = fm.bottom - fm.top + fm.leading
mText.split("\n").forEachIndexed { idx, line ->
    val baseline = idx * lineHeight + (-fm.top)  // fm.top is negative
    canvas.drawText(line, 0f, baseline, paint)
}
Posted by: Guest on March-05-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language