【问题标题】:get total number of radio button in radio group android获取单选按钮组android中的单选按钮总数
【发布时间】:2021-12-29 04:17:55
【问题描述】:

我在单选组中有一组动态单选按钮,我想要其中的按钮总数。在这种特殊情况下,我有两个单选按钮,但我怎样才能得到两个?

                    for (int i = 0; i < listArray.length; i++) {
                       
                        rb = new RadioButton(this);
                        rb.setId(i);
                        rb.setTextColor(this.getResources().getColor(R.color.white));
                        rb.setText(i);
                      

                        rg.addView(rb, layoutParams);
                    }

【问题讨论】:

  • radioGroup.getChildCount(),你试过了吗?

标签: android radio-button


【解决方案1】:

你可以使用 rg.getChildCount();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-06
    • 1970-01-01
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多