Modifier le layout_span par le code
Bonjour,
En fonction d'un bouton radio sélectionné, une TableRow disparait "GONE" ou réapparait. En fonction de cela, je dois modifier le span du RadioGroup.
Voila le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| TableRow.LayoutParams params = (TableRow.LayoutParams) _radioGroupTypeDemande.getLayoutParams();
switch(checkedId) {
case R.id.radioButton1:
findViewById(R.id.tableRow1).setVisibility(0);
findViewById(R.id.tableRow2).setVisibility(8);
params.span = 5;
break;
case R.id.radioButton2:
findViewById(R.id.tableRow2).setVisibility(0);
findViewById(R.id.tableRow1).setVisibility(8);
params.span = 2;
break;
default: break;
}
_radioGroupTypeDemande.setLayoutParams(params); |
Après avoir isolé le code, c'est le params.span = 2 qui plante. L'erreur me dit "ArrayOutOfBoundException", length=5, index=5. Et je ne sais pas d'où sort ce 5...
Une idée de comment régler le problème?
Merci