On small screens the widget.newSwitch shows the text “on or off” but not on large screens. Is there a way to make it always do one or the other or detect when it is showing the text? I need to position it differently based on if it is showing the text because it is wider. Any help would be awesome.
Hi Mike,
Can you provide more details on this?
-
What theme are you using? iOS7/8? Android classic? Android “Holo-Light” or “Holo-Dark”?
-
What is the size of your content area as defined in config.lua?
-
What is your “scale” setting in config.lua?
-
What “suffix” options you have set up in config.lua, and what are the suffix values?
-
What do you mean by “small screen” and “large screen”? Is this on device or Simulator or both? If device(s), which?
Thanks,
Brent
Here is the requested info:
-
default theme (iOS7/8) using build 2393a
-
600x1024
-
letterBox
-
no suffix" options set
-
iTouch and Kindle Fire HD show the text “on, off” but my iPad 3 does not and the simulator does not
Hi Mike,
On the iOS side, is the switch white and green in the standard iOS style? And on the Fire side, is it perhaps blue-grey with the on/off text? If so, it sounds like you’re using the default theme, versus specifying a theme… so on iOS, it’s logically selecting the iOS style, but on Kindle (Android) it’s choosing the Android theme.
If you want to consistently set one style, you’ll need to use the setTheme() function:
http://docs.coronalabs.com/api/library/widget/setTheme.html
Or, if you don’t like any of the themes, you can visually stylize your switch using custom assets, as shown in the docs:
http://docs.coronalabs.com/api/library/widget/newSwitch.html
Hope this helps,
Brent
Sorry but I must not have done a good job of asking the question because I don’t have an issue with setting the style. The issue I have is with the text “on, off” that shows up on my iTouch and Kindle Fire HD but not on my iPad. The text makes the widget wider and is causing spacing issues. I want to know if there is a way to always have it show one way or the other or detect when it is there so I can space accordingly? If there is no way to do it then I will just use a different widget.
There is no mention in the api docs of the fact that the text “on, off” gets added to the widget when it gets small and changes width. You may want to add that info to the api docs.
Hi Mike,
I probably wasn’t clear enough myself. Unless you set a theme specifically, the device will choose the “default theme” based on its OS. For iOS, there is no “ON/OFF” in the switch… it’s just a little green/white toggle switch. For Android, there is the “ON/OFF” label.
You can see this in action by running the widget demo located in your local application folder:
CoronaSDK > SampleCode > Interface > WidgetDemo
There, select one of the different themes from the alert popup, choose “Other” from the options at the bottom, and see how the switch changes.
To make the switch consistent, you can use the setTheme() function as I linked to before.
Hope this clarifies it,
Brent
Hi Mike,
Can you provide more details on this?
-
What theme are you using? iOS7/8? Android classic? Android “Holo-Light” or “Holo-Dark”?
-
What is the size of your content area as defined in config.lua?
-
What is your “scale” setting in config.lua?
-
What “suffix” options you have set up in config.lua, and what are the suffix values?
-
What do you mean by “small screen” and “large screen”? Is this on device or Simulator or both? If device(s), which?
Thanks,
Brent
Here is the requested info:
-
default theme (iOS7/8) using build 2393a
-
600x1024
-
letterBox
-
no suffix" options set
-
iTouch and Kindle Fire HD show the text “on, off” but my iPad 3 does not and the simulator does not
Hi Mike,
On the iOS side, is the switch white and green in the standard iOS style? And on the Fire side, is it perhaps blue-grey with the on/off text? If so, it sounds like you’re using the default theme, versus specifying a theme… so on iOS, it’s logically selecting the iOS style, but on Kindle (Android) it’s choosing the Android theme.
If you want to consistently set one style, you’ll need to use the setTheme() function:
http://docs.coronalabs.com/api/library/widget/setTheme.html
Or, if you don’t like any of the themes, you can visually stylize your switch using custom assets, as shown in the docs:
http://docs.coronalabs.com/api/library/widget/newSwitch.html
Hope this helps,
Brent
Sorry but I must not have done a good job of asking the question because I don’t have an issue with setting the style. The issue I have is with the text “on, off” that shows up on my iTouch and Kindle Fire HD but not on my iPad. The text makes the widget wider and is causing spacing issues. I want to know if there is a way to always have it show one way or the other or detect when it is there so I can space accordingly? If there is no way to do it then I will just use a different widget.
There is no mention in the api docs of the fact that the text “on, off” gets added to the widget when it gets small and changes width. You may want to add that info to the api docs.
Hi Mike,
I probably wasn’t clear enough myself. Unless you set a theme specifically, the device will choose the “default theme” based on its OS. For iOS, there is no “ON/OFF” in the switch… it’s just a little green/white toggle switch. For Android, there is the “ON/OFF” label.
You can see this in action by running the widget demo located in your local application folder:
CoronaSDK > SampleCode > Interface > WidgetDemo
There, select one of the different themes from the alert popup, choose “Other” from the options at the bottom, and see how the switch changes.
To make the switch consistent, you can use the setTheme() function as I linked to before.
Hope this clarifies it,
Brent