Hi, despite the fact that the ‘resize’ method should kill the orientation change bug on tablets with Android 4, I’m still having orientation change issue on Sony Xperia Z tablet with android 4.3. I use the ‘resize’ method, but still my content changes weird - I have margins remaining on both sides of my Sony display. What am I doing wrong? I’m using the latest daily build from yesterday (29th May 2014).
Here’s my resize method:
local function onResize2( event ) \_W = display.contentWidth \_H = display.contentHeight if back then back.x, back.y = \_W\*0.5, \_H\*0.5 end if webView then webView.width = \_W webView.height = \_H-40 menuBack.width, menuBack.height, menuBack.x,menuBack.y = \_W, \_H-40, \_W\*0.5, \_H\*0.5+20 webView.y = \_H\*0.5+20 headerBack.width = \_W headerBack.x = \_W\*0.5 headerLogo.x = \_W\*0.5 end end -- Add the "resize" event listener. Runtime:addEventListener( "resize", onResize2 )
and here’s my config.lua scaling:
--calculate the aspect ratio of the device: local aspectRatio = display.pixelHeight / display.pixelWidth application = { content = { width = aspectRatio \> 1.5 and 320 or math.ceil( 480 / aspectRatio ), height = aspectRatio \< 1.5 and 480 or math.ceil( 320 \* aspectRatio ), scale = "letterBox", fps = 60, imageSuffix = { ["@2x"] = 1.5, ["@4x"] = 3.0, }, }, }
please help :( When I launch the app vertically it’s fine, when I launch the app horizontally it’s fine. But when I change the orientation - the other orientation always appears with margins, like it was setting the new display.contentWidth to small than it actually is.
Does anyone has any ideas what’s happening here?
It’s pretty urgent
Cheers,
PS. I tried also using display.viewableContent* values but it’s the same