我想通過這種方式表明兩點:

我可以查閱一些參考資料嗎?
uj5u.com熱心網友回復:
只需使用 aCanvas并繪制 2 個圓圈和 1 條線。
Canvas(Modifier.fillMaxSize()){
val radius = 64f //radius of circles
val strokeWidth = 20f
val lineHeight = 300f
val centerFirstCircle = Offset(100f, 100f)
drawCircle(
color = Color.Red,
radius = radius,
center = centerFirstCircle,
style = Stroke(width = strokeWidth)
)
//calculate the start and end of the vertical line
val xLine = centerFirstCircle.x
val yLine = centerFirstCircle.y radius strokeWidth/2
drawLine(
color = Red,
start = Offset(xLine, yLine),
end = Offset(xLine , yLine lineHeight),
strokeWidth = strokeWidth
)
//calculate the center of the second circle
val centerSecondCircle = Offset( centerFirstCircle.x,
centerFirstCircle.y (radius*2) lineHeight (strokeWidth/2 *2) )
drawCircle(
color = Color.Red,
radius = radius,
center = centerSecondCircle,
style = Stroke(width = strokeWidth)
)
}

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/537500.html
標籤:安卓android-jetpack-撰写android-jetpack-compose-canvas
上一篇:ggplot2:你能在后續層中訪問.data引數嗎?
下一篇:Java類如何擴展Kotlin庫
