I'm using the StaticLayout.Builder in Android, and have created a text that i want to be at the edge of the top of the canvas, however i can't seem to get rid of a margin that comes between top of canvas (y=0) and text.
I have tried simply setting y=0, and remove all kind of padding/margin i can find like:
val textPaint = TextPaint().apply { color = Color.RED; textSize = 50f; isAntiAlias = true
val metrics = fontMetrics
metrics.ascent = 0f
metrics.descent = 0f
metrics.top = 0f
}
And use "setIncludePad(false)" on the builder.
It seems that right, left and bottom don't have the padding/margin, its only on top. I have also drawn a basic "rect" using x=0 and y=0 which aligns at all 4 edges, so the canvas should be correctly set and have its edges on correct places.
Does anyone know why there is a margin over the text when using StaticLayout and setting y=0, and how to get rid of it?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745564966a4633338.html
评论列表(0条)