Step 1: Set the theme to Android Holo Dark/Light
Step 2: Paste in these code.
local widget = require "widget" widget.setTheme("widget\_theme\_android\_holo\_dark") local rect = display.newRect(display.contentCenterX, display.contentCenterY, display.contentWidth, display.contentHeight) rect:setFillColor(0.5) local switch = widget.newSwitch{ style = "onOff", } switch:setState({isOn = false, isAnimated = false})
Expected behaviour is a switch widget which is in ‘Off’ state. But we get ‘On’ instead.