我正在嘗試使用 GXUI 在 Go 中向我的應(yīng)用程序窗口添加滾動(dòng)條。說我有這個(gè)代碼: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)}當(dāng)我運(yùn)行它時(shí),我得到這個(gè)窗口:如何讓窗口具有滾動(dòng)條以便我可以查看所有行?
- 2 回答
- 0 關(guān)注
- 214 瀏覽
添加回答
舉報(bào)
0/150
提交
取消