Hi all,
I am trying to display an image that fills 85% of the screen’s width and then put a button next to it (filling the remaining 15%). The code works on the simulator for all the phone types but if I chose one of the iPads in the simulator, the button appears shifted to the right (only half of it appears and the rest is off screen).
Here is my code ( main.lua):
local widget = require("widget") widget.setTheme( "widget\_theme\_android\_holo\_light" ) function handleButtonEvent(event) print("Button pressed") end title\_width = display.safeActualContentWidth \* 0.85 title\_height = 50 local title = display.newImageRect( "language\_selection\_title\_en.png", title\_width, title\_height ) title.x = display.safeScreenOriginX + title.width / 2 title.y = display.safeScreenOriginY + title.height / 2 b\_button = widget.newButton( { width = display.safeActualContentWidth - title\_width, height = title\_height, left = title\_width + 1 , top = display.safeScreenOriginY, id = "b\_btn", label = "B", onEvent = handleButtonEvent, } )
My config.lua file
application = { content = { width = 320, height = 480, scale = "letterbox", fps = 60, }, }
If I print the b_button.x value, it is correct. Is this just a simulator issue or am I doing something wrong?
Also, is the way I am calculating items location OK or is there a better method (e.g. layout manager)?
I have attached a sample file.
Thanks.