make background of a scrollView transparent

hi, 

i made a scrollView and i want its background to be transparent so that the app background will show, and only the objects inside the scrollView will be visible.

how can i do this?

thanks

Hi,

Just set the property to hide the background:

hideBackground=false

It must be inserted when you create the scroll:

-- Create the widget local scrollView = widget.newScrollView( { top = 0, left = 0, width = 300, height = 400, hideBackground = true, scrollWidth = 600, scrollHeight = 800, listener = scrollListener } )

here is a simple example:

local widget = require("widget") local random = math.random local bg = display.newRect( 160, 250, 500, 500) bg:setFillColor( 1, 0, 0 ) -- Create the widget local scrollView = widget.newScrollView( { top = 0, left = 0, width = 300, height = 400, hideBackground = true, scrollWidth = 600, scrollHeight = 800 } ) local obj = {} for i = 1, 10 do obj[i] = display.newCircle( 0, 0, 15 ) obj[i]:translate( random(0,320), random(0,480) ) obj[i]:setFillColor( random(), random(), random() ) scrollView:insert(obj[i]) end

However, I recommend you always look at the documentation: https://docs.coronalabs.com/api/library/widget/newScrollView.html

thanks!

Hi,

Just set the property to hide the background:

hideBackground=false

It must be inserted when you create the scroll:

-- Create the widget local scrollView = widget.newScrollView( { top = 0, left = 0, width = 300, height = 400, hideBackground = true, scrollWidth = 600, scrollHeight = 800, listener = scrollListener } )

here is a simple example:

local widget = require("widget") local random = math.random local bg = display.newRect( 160, 250, 500, 500) bg:setFillColor( 1, 0, 0 ) -- Create the widget local scrollView = widget.newScrollView( { top = 0, left = 0, width = 300, height = 400, hideBackground = true, scrollWidth = 600, scrollHeight = 800 } ) local obj = {} for i = 1, 10 do obj[i] = display.newCircle( 0, 0, 15 ) obj[i]:translate( random(0,320), random(0,480) ) obj[i]:setFillColor( random(), random(), random() ) scrollView:insert(obj[i]) end

However, I recommend you always look at the documentation: https://docs.coronalabs.com/api/library/widget/newScrollView.html

thanks!