почему все checkbox создаются в одном и том же месте? как сделать что бы они создавались один за другим
Код:
int tmpCountPack = (int)Math.floor(Calc.Lkab()/getResources().getIntArray(R.array.length_set_of_cable)[1] + 1);
checkBoxes[0].setText(getResources().getStringArray(R.array.label_set_of_cable)[1] +
"\nКол-во комплектов: " + Integer.toString(tmpCountPack) +
"\nСумма: " + Integer.toString(getResources().getIntArray(R.array.price_set_of_cable)[1] * tmpCountPack) + "руб\n");
checkBoxes[0].setChecked(true);
checkBoxes[0].setLayoutParams(layoutParams);
relativeLayoutCalcLayout.addView(checkBoxes[0]);
checkBoxes[1].setText(getResources().getStringArray(R.array.label_additional_elements)[0] +
"\nКол-во: " + Integer.toString(tmpCountPack) +
"\nСумма: " + Integer.toString(getResources().getIntArray(R.array.price_addirional_elements)[0] * tmpCountPack));
checkBoxes[1].setChecked(true);
layoutParams.topMargin += checkBoxes[0].getHeight() + 10;
checkBoxes[1].setLayoutParams(layoutParams);
relativeLayoutCalcLayout.addView(checkBoxes[1]);
checkBoxes[2].setText(getResources().getStringArray(R.array.label_additional_elements)[1] +
"\nКол-во: " + Integer.toString(tmpCountPack) +
"\nСумма: " + Integer.toString(getResources().getIntArray(R.array.price_addirional_elements)[1] * tmpCountPack));
checkBoxes[2].setChecked(true);
layoutParams.topMargin += checkBoxes[1].getHeight() + 10;
checkBoxes[2].setLayoutParams(layoutParams);
relativeLayoutCalcLayout.addView(checkBoxes[2]);
checkBoxes[3].setText(getResources().getStringArray(R.array.label_additional_elements)[2] +
"\nКол-во: " + Integer.toString(tmpCountPack) +
"\nСумма: " + Integer.toString(getResources().getIntArray(R.array.price_addirional_elements)[2] * tmpCountPack));
checkBoxes[3].setChecked(true);
layoutParams.topMargin += checkBoxes[2].getHeight() + 10;
checkBoxes[3].setLayoutParams(layoutParams);
relativeLayoutCalcLayout.addView(checkBoxes[3]);