GitHub Issue | n/a |
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-12-09T00:39:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 4.0.0 |
Components | Android |
Labels | exalture, module_switch, notable, qe-manualtest, qe-testadded |
Reporter | Carter Lathrop |
Assignee | Sunila |
Created | 2013-06-10T10:51:20.000+0000 |
Updated | 2015-03-19T22:09:43.000+0000 |
It would be nice to have a Real Android Switch when developing for Android 14 and above. The one supplied with Titanium now is not very nice.
Hello Thomas, Have you tried using the holo themes and the UI components (eg. the switches) that come with that? By default the android UI features are from API level 8 but it is possible to get a different, more modern looking UI for API levels 14 and up by using the holo themes (light or dark). This should give you a nicer looking switch. For more reference: http://developer.appcelerator.com/question/130719/how-do-you-build-your-app-with-holo-theme Also, it is possible to create your own custom switch if what you are looking for is not available, but the holo theme'd switches should be fine for what you are asking. If you have any more questions or comments please feel free to ask. Regards, Carter
Hi Carter... I Attached a picture of a switch with halo enabled... and it does not look anything like the ones in settings.. I'm from denmark so Til = On :) Am I doing something wrong ?
Hi Thomas, Sorry for the confusion here, you are indeed right, the switches in Titanium are just Android toggles, unless specified as a checkbox, and there is a need for real switches that correlate to the native android UI. I will move this to engineering and they will process your request. Thanks for the suggestion. Regards, Carter
Here's a native module for it: https://github.com/dbankier/RealSwitch
David: Thanks for the module. I'm surprised the titanium dev's didn't include this in their recent 3.4.0 release... Android 4.0 has been out for quite some time now...
https://github.com/appcelerator/titanium_mobile/pull/6324 Added support for switch for ICS and older versions
Confirming that on SDK 14+ we should show a switch, otherwise a toggle. [~rblalock] [~aleard] [~grantges] Thoughts?
Okay, so the Titans would like access to both switch types. By default, use old style, pre-14, use new style post-14 But, allow option to use old style, post-14
Pre 14 we should default to the older square version. 14 and higher default to the newer and much better looking and correct version. However I suggest that the option to swap between is maintained so those that built a UI around the older square (ugly) version may continue to support that. I may be wrong but I thought there was a third-type switch native to Android. Whilst you are in there, throw it in if it does exist please.
[~core13], only two according to this: http://developer.android.com/guide/topics/ui/controls/togglebutton.html
The 4.0+ switch can manifest itself with at least 2 different styles. !http://content.screencast.com/users/Stephen_Feather/folders/Jing/media/9d78e10c-aceb-46af-a7a3-89fdf3ce474d/00000705.png! one shown in the android docs, with the sharp razor edge feel, or the above.
Ricardo, yes but those are only the toggle subset, however - these were the others; http://developer.android.com/design/building-blocks/switches.html The existing switch on android provides a toggle button as default or a check box with a style property change. This however does not include the related radio version which would be a very welcome addition - even if the toggle state was left to the developer (assuming the action would not be handled automatically thus Appc work would be increased). So in reality we have; - Toggle Button / On Off Button - Check Box - Radio Button The UI of the On/OFF button changes massively between pre and post 4.x Android. Given the lack of a true Android 4.x UI version of the On/Off Button - many devs will have built UIs around the only alternative. Changing the UI to match one control is often not as easy as it sounds as large projects need sign off on UI changes. I welcome and beg for the correct 4.x On/Off - but other devs will need to be able to switch back. As Titanium appears to have created a synthetic version of the true/control (assuming that is the reason it did not inherit the correct style change in 4.x) then that should be maintained at least for a couple of releases. Notes; - Titanium.UI.Android.SWITCH_STYLE_CHECKBOX - Titanium.UI.Android.SWITCH_STYLE_TOGGLEBUTTON
Verified the implementation. Devices with API 14+ will see the new switch by default while API<14 will see the old version of switch. We can specify style:Titanium.UI.Android.SWITCH_STYLE_TOGGLEBUTTON_OLD for devices with API 14+ for the old version of switch. Closing. Environment: Appc Studio : 3.5.1.201412091616 Ti SDK : 4.0.0.v20150317234215 CLI : 4.0.0-alpha Alloy : 1.6.0-alpha MAC Yosemite : 10.10.2 Nexus 5: Android 5.0 Samsung Galaxy S3 : Android 4.0.4