I wanted to put dynamically the checkboxes with the names that I retrieve from the API one below the other, but when I run the code the checkbox I see just one and the others are in the back of it
JSONObject json = new JSONObject(result);
arr = json.getJSONArray("functionality");
for(int i = 0; i < arr.length(); i++) {
String name = arr.getJSONObject(i).getString("name");
CheckBox check = new CheckBox(rootView.getContext());
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
check.setLayoutParams(lparams);
check.setText(name);
container.addView(check);
}
Aucun commentaire:
Enregistrer un commentaire