2013-05-08 78 views
0

是否有一个fill_parentwrap_content功能在电晕中就像在Android?所以它将适合每个屏幕方向的背景图像。或者它有不同的方法来做到这一点。填补父母在科罗娜.lua

在此先感谢。

回答

0

没有任何wrap_content,因为您没有corona中的视图组。你有简单的团体,但你可以效仿wrap_content。也有文本模块至极会帮助你,检查http://developer.coronalabs.com/code/

是的,你可以实现在每个屏幕方向FILL_PARENT

local W = display.contentWidth 
local H = display.contentHeight 
local background 

local function drawInterface() 
    background = display.newRect(0, 0, W, H) 
    background.x = display.contentCenterX 
    background.y = display.contentCenterY 
    background:setFillColor(99, 165, 204) 
end 

drawInterface() 

local function removeInterface() 
    if background then background:removeSelf() end 
end 

local function onOrientationChanged (event) 
    print("orientation changed") 
    W = display.contentWidth 
    H = display.contentHeight 

    removeInterface() 
    drawInterface() 
end 

Runtime:addEventListener("orientation", onOrientationChanged)