0

电晕中是否有fill_parentorwrap_content功能,就像在 android 中一样?因此它将适合每个屏幕方向的背景图像。或者它对此有不同的方法。

提前致谢。

4

1 回答 1

0

There isn't any wrap_content because you don't have view groups in corona. You have simple groups but you can emulate wrap_content. There are also text modules wich will help you, check http://developer.coronalabs.com/code/

Yes you can implement fill_parent on every Screen Orientation:

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 ) 
于 2013-05-08T16:09:20.667 回答