fyne表单布局
layout.FormLayout
就像一个 2 列网格布局 。
package main
import (
"image/color"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
)
func main() {
myApp := app.New()
myWindow := myApp.NewWindow("golang-tech-stack.com")
// 标签1
label1 := canvas.NewText("Label 1", color.Black)
// 值1
value1 := canvas.NewText("Value 1", color.Black)
// 标签2
label2 := canvas.NewText("Label 2", color.Black)
// 值2
value2 := canvas.NewText("Value 2", color.Black)
// 表单布局
grid := container.New(layout.NewFormLayout(), label1, value1, label2, value2)
myWindow.SetContent(grid)
myWindow.ShowAndRun()
}