Corona SDK中的水平ScrollView

时间:2013-11-06 23:29:57

标签: lua corona

我在corona sdk中创建了一个滚动视图,但是我遇到了一些问题,我只需要水平滚动它。任何帮助?

local widget = require("widget")

local rect1 = display.newRect(20,100,150,100)
local rect2 = display.newRect(200,100,150,100)
local rect3 = display.newRect(380,100,150,100)
local rect4 = display.newRect(580,100,150,100)
local rect5 = display.newRect(780,100,150,100)

local scrollView = widget.newScrollView{ left = 0, width = 0, height = 200, }

scrollView:insert(rect1);
scrollView:insert(rect2);
scrollView:insert(rect3);
scrollView:insert(rect4);
scrollView:insert(rect5);

2 个答案:

答案 0 :(得分:4)

根据Corona SDK API,您可以执行以下操作:

scrollView.verticalScrollDisabled = true

答案 1 :(得分:2)

local scrollView = widget.newScrollView{ left = 0, width = 0, height = 200, verticalScrollDisabled = true,}