how to generate dynamic RadioButton with a radiongroup in adapterView?

后端 未结 1 546
名媛妹妹
名媛妹妹 2021-01-07 03:59

I have a Dynamic list..

I want to show that list in adapter view with radio buttons. in one group.

I used:

public class Type2Adapter extends          


        
相关标签:
1条回答
  • 2021-01-07 04:22
      <RadioGroup 
                android:id="@+id/optionRadioGroup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" > 
       </RadioGroup>
    
    //here i am adding 6 radiobutton .
    
    rgroup=(RadioGroup)findViewById(R.id.optionRadioGroup);
    
    for(int i=0; i<6; i++)
    {
           rb[i]=new RadioButton(context);
           rb[i].setText("rdo"+i);
           rb[i].setId(i);
           rgroup.addView(rb[i]);           
      }       
    
    0 讨论(0)
提交回复
热议问题