Hi
I used the ScrollView sample code from Corona installation, and I found I cannot fixed the hegith of ScrollViewl
The following source is same as Corona default installation, and I just set backgroup color to see what happend for the height of Scrollview after I set height=display.contentHeight*0.5.
display.setDefault( “background”, 0,255, 0 )
display.setStatusBar( display.HiddenStatusBar )
local widget = require( “widget” )
local scrollView = widget.newScrollView
{
left = 0,
top = 0,
width = display.contentWidth,
height = display.contentHeight*0.5 ,
bottomPadding = 50,
id = “onBottom”,
horizontalScrollDisabled = true,
verticalScrollDisabled = false,
listener = scrollListener,
}
–Create a large text string
local lotsOfText = "Lorem ipsum dolor sit amet, … "
–Create a text object containing the large text string and insert it into the scrollView
local lotsOfTextObject = display.newText( lotsOfText, 0, 0, 300, 0, “Helvetica”, 14)
lotsOfTextObject:setTextColor( 0 )
lotsOfTextObject:setReferencePoint( display.TopCenterReferencePoint )
lotsOfTextObject.x = display.contentCenterX
lotsOfTextObject.y = titleText.y + titleText.contentHeight + 10
scrollView:insert( lotsOfTextObject )
The screen result is as following pic:
The above source code set the background color of screen is green and the background color of screen is white.
And you can find even I set _ height = display.contentHeight*0.5, _ actually the text out of scrollview is still in the screen (green area).
How to set exactly scrollview size thus the text is only shown in scrollview area ?
Thanks