android单选按钮_Android单选按钮示例

android单选按钮

Radio Button in android apps are very common. In this tutorial we’ll implement android radio button widget in our application. Radio Buttons are used when we need to select only one item from a list of presented items.

android应用中的单选按钮非常常见。 在本教程中,我们将在应用程序中实现android单选按钮小部件。 当我们只需要从显示的项目列表中选择一个项目时,使用单选按钮。

Android单选按钮 (Android Radio Button)

A radio button consists of two states – checked and unchecked. Clicking an unchecked button changes its state to “checked” state and “unchecked” for the previously selected radio button. To toggle a checked state to unchecked state, we need to chose another item. Clicking a checked state button doesn’t do any good. A RadioGroup is a set of radio buttons. Radio Buttons that have different parent ViewGroup can’t be termed as a RadioGroup.

单选按钮包含两个状态-选中和未选中。 单击未选中的按钮,将其状态更改为“选中”状态,将先前选择的单选按钮的状态更改为“未选中”。 要将选中状态切换为未选中状态,我们需要选择另一项。 单击选中的状态按钮没有任何好处。 RadioGroup是一组单选按钮。 具有不同父ViewGroup的单选按钮不能称为RadioGroup。

Android单选按钮属性 (Android Radio Button attributes)

Some of the attributes of android radio button and radio group are listed below:

下面列出了android单选按钮和单选组的一些属性:

  1. android:orientation : This property on the Radio group defines the orientation to position its child view consisting of Radio Buttons. It can be either horizontal or vertical

    android:orientation :单选按钮组上的此属性定义用于定位其子视图(由单选按钮组成)的方向。 它可以是水平或垂直的
  2. check(id) : This sets the selection to the radio button whose identifier is passed in parameter. -1 is used as the selection identifier to clear the sele
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值