[TIMOB-3200] Android: Add radio button group support
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2020-02-13T15:12:47.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | n/a |
Components | Android |
Labels | android, api, button |
Reporter | Ian Hawes |
Assignee | Yordan Banev |
Created | 2011-04-15T03:39:18.000+0000 |
Updated | 2021-01-16T03:20:30.000+0000 |
Description
*Summary:*
We should add a radio button group like feature on all platforms (Android, iOS, and Windows) where a horizontal layout of buttons are displayed, but only one option can be selected at a time.
On Android and Windows, this is a built-in UI component that we should use.
https://developer.android.com/guide/topics/ui/controls/radiobutton
On iOS, this should be implemented via a
UISegmentedControl
.
https://developer.apple.com/design/human-interface-guidelines/ios/controls/segmented-controls
*Recommend Solution:*
Should be implemented in Titanium similar to Ti.UI.TabbedBar
...
https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.TabbedBar
The idea is that the Titanium developer creates the "group" view, but does not have access to the individual buttons within the group. This will help make it more portable between Android and iOS.
The radio buttons will be created via a creation-only "labels" property, which is assigned an array of strings, just like how it works with Ti.UI.TabbedBar
and Ti.UI.ButtonBar
.
We should also support an "index" property to indicate which button is selected and the "click" event when a button has been clicked on. This is how it's implemented in Ti.UI.TabbedBar
as well.
The layout should be horizontal by default. Especially since iOS' UISegmentedControl
can only be displayed horizontally. Vertical layout support would be nice, but it is only natively supported on Android and Windows.
*Future:*
We may also want to support the "Choice Chips" feature as shown in Google's material design below. New Chip
and ChipGroup
Java classes have been added to Google's Support Library version 28. This could be implemented via the view's "style" property in the future.
https://material.io/design/components/chips.html
Can't seem to find that we have a radio widget for Android in our docs, changed from bug to feature request.
We don't want to implement it for iOS, but here's a discussion for doing so: http://stackoverflow.com/questions/4847296/best-radio-button-implementation-for-ios
PR : https://github.com/appcelerator/titanium_mobile/pull/5352
closed in favor of TIMOB-25954
The plan is to implement radio buttons via: [TIMOB-28317]