First time using scrollviews and I it seems they don’t quite work how I’d expected…
The following creates scrollingContent in the right place (contentAreaTop etc are calculated based on previously added elements). contentGroup is just a display group for z-ordering.
heightHandle though, appears to be being positioned relative to the centre of the scrollview?
Of course I could just manually deduct half of the width and height to compensate, but I wanted to check there isn’t a more ‘proper’ method than that? I don’t want to end up skewing the actual scroll mechanic later on when this thing has more than just a rect sitting in it…
local scrollingContent = widget.newScrollView( { left = 0, top = contentAreaTop, width = 320, height = contentAreaHeight, horizontalScrollDisabled = true, backgroundColor = { 233 / 255, 191 / 255, 121 / 255 }, hideScrollBar = true, bottomPadding = 40 } ) contentGroup:insert(scrollingContent) local heightHandle = display.newRect( scrollingContent, 160, 0, 320, 50 ) heightHandle:setFillColor( 106 / 255, 110 / 255, 47 / 255 ) heightHandle.anchorY = 0