Hi Corona Guys,
I am the beginner of corona.So, please some one answer my question.
I have few question about widget and storyboard.
- I am using widget demo sample code for my project.
- In my application I want to create 5 tab bar buttons.Each buttons have different kind of action.
My question is In corona simulator Working fine But I installed in my Android device Tab bar and Top bar are not visible. only scroll view and table view is working correctly.
Please try to some one help me.
Corona build 783
----- Code --------------------------------
local storyboard = require( “storyboard” )
local widget = require “widget”
local scene = storyboard.newScene()
local bottomBar ,topBar,label_Title,shadow,bottomShadow,calendar_Bar,left_Arrow,right_Arrow,scrollBox,bg
local scene1 = storyboard.newScene(“home”)
local scene2 = storyboard.newScene(“settings”)
topBar = widget.newTabBar{
background = “assets/common/topbar.png”,
}
label_Title = display.newEmbossedText( “Home”, 0, 0, native.systemFontBold, 20 )
label_Title:setReferencePoint( display.CenterReferencePoint )
label_Title:setTextColor( 0,0,0,255 )
label_Title.x = 160
label_Title.y = topBar.y
shadow = display.newImage( “assets/shadow.png” )
shadow:setReferencePoint( display.TopLeftReferencePoint )
shadow.x, shadow.y = 0, top
shadow.xScale = 320 / shadow.contentWidth
shadow.alpha = 0.45
local button_Images = {
{
– label=“tableView”,
default=“assets/buttons/home.png”,
down=“assets/buttons/homehover.png”,
width=64, height=40,
onPress=function() storyboard.gotoScene(“home”); end,
selected=true
},
{
– label=“tableView”,
default=“assets/buttons/list.png”,
down=“assets/buttons/listhover.png”,
width=64, height=40,
onPress=function() storyboard.gotoScene(“list”); end,
},
{
– label=“tableView”,
default=“assets/buttons/bar.png”,
down=“assets/buttons/barhover.png”,
width=64, height=40,
onPress=function() storyboard.gotoScene(“bar”); end,
},
{
– label=“tableView”,
default=“assets/buttons/addpurchase.png”,
down=“assets/buttons/addpurchasehover.png”,
width=64, height=40,
onPress=function() storyboard.gotoScene(“addpurchase”); end,
},
{
– label=“settings”,
default=“assets/buttons/settings.png”,
down=“assets/buttons/settingshover.png”,
width=64, height=40,
onPress=function() storyboard.gotoScene(“settings”); end,
}
}
bottomBar = widget.newTabBar{
top=display.contentHeight-50,
background = “assets/common/downbar.png”,
buttons=button_Images
}
bottomShadow = display.newImage( “assets/shadowbottom.png” )
bottomShadow:setReferencePoint( display.BottomLeftReferencePoint )
bottomShadow.x, bottomShadow.y = 0, display.contentHeight-50
bottomShadow.xScale = 320 / bottomShadow.contentWidth
bottomShadow.alpha = 0.45
function scene1:createScene( event )
local group = self.view
print(“First”)
– label_Title:setText( “Your Purchases”, { 255, 255, 255 } )
calendar_Bar = widget.newTabBar{
top = 50,
background = “assets/common/calender/calendarbar.png”,
}
group:insert(calendar_Bar)
left_Arrow = widget.newButton{
default = “assets/common/calender/leftarrow.png”,
over = “assets/common/calender/leftarrowhover.png” ,
width = 33,height = 32,
}
left_Arrow.x = 25
left_Arrow.y = calendar_Bar.y
group:insert(left_Arrow)
right_Arrow = widget.newButton{
default = “assets/common/calender/rightarrow.png”,
over = “assets/common/calender/rightarrowhover.png” ,
width = 33,height = 32,
}
right_Arrow.x = display.contentWidth - 25
right_Arrow.y = calendar_Bar.y
group:insert(right_Arrow)
– create scrollView widget that scrolls horizontally/vertically if
– scrollWidth/Height params are greater than width/height parameters
scrollBox = widget.newScrollView{
top = 100,
width = 320, height = 380,
scrollWidth = 320, scrollHeight = 700,
maskFile = “assets/mask.png”
}
bg = display.newImageRect( “assets/scrollimage.jpg”, 320, 700 )
bg:setReferencePoint( display.TopLeftReferencePoint )
bg.x, bg.y = 0, 0
scrollBox:insert( bg )
– don’t forget to insert objects into the scene group!
group:insert( scrollBox )
end
scene1:addEventListener( “createScene”, scene1 )
function scene1:enterScene( event )
end
scene1:addEventListener(“enterScene”,scene1)
function scene1:exitScene( event )
end
scene1:addEventListener( “exitScene”, scene1 )
function scene1:destroyScene( event )
end
scene1:addEventListener( “destroyScene”, scene1 )
function scene2:createScene( event )
local group = self.view
end
scene2:addEventListener( “createScene”, scene2 )
function scene2:enterScene( event )
end
scene2:addEventListener(“enterScene”,scene2)
function scene2:exitScene( event )
end
scene2:addEventListener( “exitScene”, scene2 )
function scene2:destroyScene( event )
end
scene2:addEventListener( “destroyScene”, scene2 )
storyboard.gotoScene( “home” )
return scene
--------------------------- [import]uid: 119468 topic_id: 25502 reply_id: 325502[/import]