big radio button android studio
<RadioButton
android:scaleX="1.3"
android:scaleY="1.3" />
big radio button android studio
<RadioButton
android:scaleX="1.3"
android:scaleY="1.3" />
android dynamic radio group
public class ActivityMain extends AppCompatActivity implements View.OnClickListener {
EditText mEtNumOfRadioBtns;
Button mBtnAdd;
String TAG = "TestActivity";
RadioGroup mRgAllButtons;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//
mEtNumOfRadioBtns = findViewById(R.id.et_no);
mBtnAdd = findViewById(R.id.btn);
mRgAllButtons = findViewById(R.id.radiogroup);
//
mBtnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int number = Integer.parseInt(mEtNumOfRadioBtns.getText().toString().trim());
addRadioButtons(number);
}
});
}
public void addRadioButtons(int number) {
mRgAllButtons.setOrientation(LinearLayout.HORIZONTAL);
//
for (int i = 1; i <= number; i++) {
RadioButton rdbtn = new RadioButton(this);
rdbtn.setId(View.generateViewId());
rdbtn.setText("Radio " + rdbtn.getId());
rdbtn.setOnClickListener(this);
mRgAllButtons.addView(rdbtn);
}
}
@Override
public void onClick(View v) {
Log.d(TAG, " Name " + ((RadioButton)v).getText() +" Id is "+v.getId());
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us