Though I have been through many questions regarding relative layout and adding child view programatically, I am unable to resolve this issue
for (int i=0; i
Create new instances of ImageView
and TextView
inside the loop
for (int i = 0; i < views; i++) {
LayoutParams img_params= new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
img_params.addRule(RelativeLayout.ALIGN_PARENT_LEFT|RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
ImageView img = new ImageView(this);
relativeLayout.addView(img, img_params);
LayoutParams text_params= new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
text_params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT|RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
TextView textview = new TextView(this);
relativeLayout.addView(textview, text_params);
}