我正在嘗試使用 GXUI 在 Go 中向我的應用程序窗口添加滾動條。說我有這個代碼:package mainimport ( "fmt" "github.com/google/gxui" "github.com/google/gxui/drivers/gl" "github.com/google/gxui/samples/flags" "github.com/google/gxui/themes/dark")func appMain(driver gxui.Driver) { theme := dark.CreateTheme(driver) window := theme.CreateWindow(800, 600, "Grid") window.SetScale(flags.DefaultScaleFactor) window.OnClose(driver.Terminate) row := theme.CreateLinearLayout() row.SetDirection(gxui.LeftToRight) for c := 0; c < 4; c++ { col := theme.CreateLinearLayout() col.SetDirection(gxui.TopToBottom) for r := 0; r < 100; r++ { cell := theme.CreateLabel() cell.SetText(fmt.Sprintf("%d", r*4+c)) col.AddChild(cell) } row.AddChild(col) } window.AddChild(row)}func main() { gl.StartDriver(appMain)}當我運行它時,我得到這個窗口:如何讓窗口具有滾動條以便我可以查看所有行?
- 2 回答
- 0 關注
- 223 瀏覽
添加回答
舉報
0/150
提交
取消