Problem with ScrollView

At first I will say my english is bad, i hope you understand me.

Hello, i am tottaly new at the corona, i have problem with ScrollView.

For my application i want add scrollview like on facebook, i scroll down, and this stay.

this is my code:

[lua]local background = display.newImageRect( “background.png”, 360, 570 )

background.x = display.contentCenterX

background.y = display.contentCenterY

local label1 = display.newImage( “label.png”, 160, 0 )

local label2 = display.newImage( “label.png”, 160, 100 )

local label3 = display.newImage( “label.png”, 160, 200 )

local label4 = display.newImage( “label.png”, 160, 300 )

local label5 = display.newImage( “label.png”, 160, 400 )

local label6 = display.newImage( “label.png”, 160, 500 )

local label7 = display.newImage( “label.png”, 160, 500 )

local b = display.newText( “b”, 40, 110, native.systemFont, 30)

b.x = display.contentWidth * 0.5

b.y = display.contentHeight - (display.contentHeight*0.03)

b:setFillColor( 255, 0, 0 )

local labelmenu = display.newImage( “labelmenu.png”, 160, 500 )

local a = display.newText( “a”, 40, 110, native.systemFont, 30)

a.x = display.contentWidth * 0.5

a.y = display.contentHeight - (display.contentHeight*0.75)

a:setFillColor( 255, 0, 0 )

[/lua]

and app look like on bottom screen, i want to see “b”, using scrollview.

i

Default language? 

First you need to requiere the widget library. Second you need to insert the objects inside the scrollview widget. Third scroll. That’s it.

Read this:

https://docs.coronalabs.com/api/library/widget/newScrollView.html

What language?

Thanks for help, but i have other problem.

Does not want to see blank white space when i move up and down i want limit.

this is my code, how can you  tell if there is anything to improve:

[lua]-----------------------------------------------------------------------------------------

– main.lua


local widget = require( “widget” )

local background = display.newImageRect( “background.png”, 640, 780 )

background.x = display.contentCenterX

background.y = display.contentCenterY

local labelmenu = display.newImage( “labelmenu.png”, 160, 500 )


– ScrollView listener

local function scrollListener( event )

 

    local phase = event.phase

    if ( phase == “began” ) then print( “Scroll view was touched” )

    elseif ( phase == “moved” ) then print( “Scroll view was moved” )

    elseif ( phase == “ended” ) then print( “Scroll view was released” )

    end

 

    – In the event a scroll limit is reached…

    if ( event.limitReached ) then

        if ( event.direction == “up” ) then print( “Reached bottom limit” )

        elseif ( event.direction == “down” ) then print( “Reached top limit” )

        elseif ( event.direction == “left” ) then print( “Reached right limit” )

        elseif ( event.direction == “right” ) then print( “Reached left limit” )

        end

    end

 

    return true

end

local scrollView = widget.newScrollView {

    horizontalScrollDisabled = true,

    width = 360,

    height = 780,

    left = 0,

    top = -45,

    --scrollWidth = 0,

    --scrollHeight =  0

}

 

local view = scrollView:getView()

 

– Create a image and insert it into the scroll view

local label1 = display.newImage( “label.png”, 160, 50 )

local label2 = display.newImage( “label.png”, 160, 150 )

local label3 = display.newImage( “label.png”, 160, 250 )

local label4 = display.newImage( “label.png”, 160, 350 )

local label5 = display.newImage( “label.png”, 160, 450 )

local label6 = display.newImage( “label.png”, 160, 550 )

local label7 = display.newImage( “label.png”, 160, 650 )

local label8 = display.newImage( “label.png”, 160, 750 )

local labelmenu = display.newImage( “labelmenu.png”, 160, 500 )

scrollView:setScrollHeight( 1050 ) 

–scrollView:insert( background )

scrollView:insert( label1 )

scrollView:insert( label2 )

scrollView:insert( label3 )

scrollView:insert( label4 )

scrollView:insert( label5 )

scrollView:insert( label6 )

scrollView:insert( label7 )

scrollView:insert( label8 )

[/lua]

Default language = Spanish, French, etc?

I really do not understand what you want to say. When you said white space do you refer to the background?

default language is Polish

I do not want to scrolling to this white background, just a limit.

Maybe the ScrollToPosition api is the one you are looking for.

I have already repaired. Thanks for help.

Default language? 

First you need to requiere the widget library. Second you need to insert the objects inside the scrollview widget. Third scroll. That’s it.

Read this:

https://docs.coronalabs.com/api/library/widget/newScrollView.html

What language?

Thanks for help, but i have other problem.

Does not want to see blank white space when i move up and down i want limit.

this is my code, how can you  tell if there is anything to improve:

[lua]-----------------------------------------------------------------------------------------

– main.lua


local widget = require( “widget” )

local background = display.newImageRect( “background.png”, 640, 780 )

background.x = display.contentCenterX

background.y = display.contentCenterY

local labelmenu = display.newImage( “labelmenu.png”, 160, 500 )


– ScrollView listener

local function scrollListener( event )

 

    local phase = event.phase

    if ( phase == “began” ) then print( “Scroll view was touched” )

    elseif ( phase == “moved” ) then print( “Scroll view was moved” )

    elseif ( phase == “ended” ) then print( “Scroll view was released” )

    end

 

    – In the event a scroll limit is reached…

    if ( event.limitReached ) then

        if ( event.direction == “up” ) then print( “Reached bottom limit” )

        elseif ( event.direction == “down” ) then print( “Reached top limit” )

        elseif ( event.direction == “left” ) then print( “Reached right limit” )

        elseif ( event.direction == “right” ) then print( “Reached left limit” )

        end

    end

 

    return true

end

local scrollView = widget.newScrollView {

    horizontalScrollDisabled = true,

    width = 360,

    height = 780,

    left = 0,

    top = -45,

    --scrollWidth = 0,

    --scrollHeight =  0

}

 

local view = scrollView:getView()

 

– Create a image and insert it into the scroll view

local label1 = display.newImage( “label.png”, 160, 50 )

local label2 = display.newImage( “label.png”, 160, 150 )

local label3 = display.newImage( “label.png”, 160, 250 )

local label4 = display.newImage( “label.png”, 160, 350 )

local label5 = display.newImage( “label.png”, 160, 450 )

local label6 = display.newImage( “label.png”, 160, 550 )

local label7 = display.newImage( “label.png”, 160, 650 )

local label8 = display.newImage( “label.png”, 160, 750 )

local labelmenu = display.newImage( “labelmenu.png”, 160, 500 )

scrollView:setScrollHeight( 1050 ) 

–scrollView:insert( background )

scrollView:insert( label1 )

scrollView:insert( label2 )

scrollView:insert( label3 )

scrollView:insert( label4 )

scrollView:insert( label5 )

scrollView:insert( label6 )

scrollView:insert( label7 )

scrollView:insert( label8 )

[/lua]

Default language = Spanish, French, etc?

I really do not understand what you want to say. When you said white space do you refer to the background?

default language is Polish

I do not want to scrolling to this white background, just a limit.

Maybe the ScrollToPosition api is the one you are looking for.

I have already repaired. Thanks for help.