I’m developing for Android and am fighting with a switch widget. I don’t understand how it is sized. According to the doc it cannot be sized by scaling or setting the width/height.
Fair enough, so I thought I could size it with the gfx in the image sheet. But no cigar. When I use the same gfx for the switch and image (as per source code below) I get two completely different sizes:
The small, almost unidentifiable square on top is how the switch ends up looking, while the same gfx (admittedly twice as wide because the whole image sheet is shown) shown as an unscaled image below.
So, how on earth is the switch widget supposed to look (nice)?
Build settings etc is attached as a zip file.
local widget = require( "widget" ) \_W = display.contentWidth \_H = display.contentHeight local options = { width = 80, height = 66, numFrames = 2, sheetContentWidth = 160, sheetContentHeight = 66 } local cbImgSheet = graphics.newImageSheet( "checkbox.png", options ) local newUserCB = widget.newSwitch { left = \_W/2, top = \_H\*0.2, style = "checkbox", sheet = cbImgSheet, frameOff = 1, frameOn = 2 } local button = display.newImage( "checkbox.png" ) button.x = \_W/2 button.y = \_H\*0.3