Nativescript 中的单选按钮

Radio Buttons in Nativescript

如何在 Nativescript 中实现 RadioButtons + Angular?

我试过 RadioButton 插件,但它在编译时出错。 我在 Whosebug 上看到 post 说明要使用 font-awesome 但似乎很难将单选按钮分组。

是不是我忽略了任何其他简单的方法来为这样的东西创建 UI :

标签=>问题:Select你最喜欢的水果?

电台 1:芒果

电台 2:苹果

电台 3 :猕猴桃

电台 4:香蕉

对创建这样的界面有什么帮助吗?

使用 Nativescript 5.0

环顾四周并观察了几个流行的电子商务应用程序后,我发现"Dialog box with List"适合普通用户使用的方法。

我决定遵循这个:https://docs.nativescript.org/angular/ui/ng-ui-widgets/dialogs

与此同时,我仍然很高兴看到 Nativescript 的纯单选按钮类型的界面,这对于拥有技术背景用户群的封闭组应用程序来说是有益的,而不是零售用户。

试试 nativescript-checkbox plugin, setting the boxType to circle will give you radio button style. For Grouped Radio Buttons,选中一个按钮后只需取消选中组中的其他单选按钮即可。

我可以使用 Switch 属性 isUserInteractionEnabled.

顺便说一句,我使用 Nativescript-angular.

这将仅在所选值不同时启用与 Switch 的交互:

<Switch [checked]="selectedValue === 'Mango'" isUserInteractionEnabled="{{ selectedValue !== 'Mango' }}"></Switch>