fyne表单布局
layout.FormLayout
就像一个 2 列网格布局 。
package mainimport ("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")// 标签1label1 := canvas.NewText("Label 1", color.Black)// 值1value1 := canvas.NewText("Value 1", color.Black)// 标签2label2 := canvas.NewText("Label 2", color.Black)// 值2value2 := canvas.NewText("Value 2", color.Black)// 表单布局grid := container.New(layout.NewFormLayout(), label1, value1, label2, value2)myWindow.SetContent(grid)myWindow.ShowAndRun()
}