I’ve been trying to use the scrollView for some time, but it behaves far from what I hoped. To give you an idea about what I consider a perfect scroll behaviour, the Android apps list is a great example:
But the Corona scrollView behaves completely different. Here are my main complaints about the Corona scrollView:
-
Constant scroll speed (not controlled by gesture speed)
I want the scrolling to be fast or slow dependent on the "flick gesture speed! As it is now, the scroll speed is completely independent of the gesture speed, making the scrollView feeling very clumsy.
-
No scrolling if the finger is moved even slightly in the opposite direction before the flicking gesture
Sometimes the user drags the (list) scrollView a bit back and forth, before he wants to scroll a bit further. This isn’t possible now, because such a movement just cancels the scroll.
-
No scrolling if the finger is moved longer than a certain distance before flicking
If the user wants to scroll fast, it’s natural to make a larger flick motion, but if the motion is over a certain distance, the scrollView also seems to cancel the scroll!
-
Occasional bugging - the scrollView scrolls in the wrong direction
This happens maybe one of 30 times I try to scroll and it is not caused by reaching the limits of the scroll area.
I have made a small video showing some of these issues: Video (sorry about the lousy resolution, it’s youtube)
The video is made in the simulator so that the “finger” is visible, but the behavior is the same on the Android device itself. The background color is changed while the mouse is pressed so that it’s easier to see how the flicking/scrolling gesture is done.
The code for the app shown in the video is this:
local widget = require( "widget" ) local w = display.contentWidth local h = display.contentHeight local background = display.newRect(w/2, h/2, w, h) background:setFillColor(0,0,0) local function scrollListener( event ) local phase = event.phase if ( phase == "began" ) then background:setFillColor(0.5,0.2,0.2) elseif ( phase == "ended" ) then background:setFillColor(0,0,0) end return true end local scrollView = widget.newScrollView { x = w/2, y = h/2, width = w\*0.75, height = h, scrollHeight = 4000, horizontalScrollDisabled = true, hideBackground = true, listener = scrollListener, } local scrollImg = display.newImageRect( "image.png", w/2, 4000 ) scrollImg.x = w/2 scrollImg.y = 2000 scrollView:insert( scrollImg )
My simple question is this:
Is this really how the scrollView is supposed to work, or am I doing something very wrong?