title: Array of image button and textview in android
body: <p>I am trying to create an array in which each item will have an image button and below that image button will be a text view in center . Can anybody tell me how to do this. I tried the below code but not getting it worked</p>
  
  <pre><code>but=new ImageButton(this);
  but.setFocusableInTouchMode(true);
  but.setId(1);
  imbrelp= new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  rel.addView(but,imbrelp);
  tv= new TextView(this);
  tvrelp= new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  tvrelp.addRule(RelativeLayout.BELOW, but.getId());
  tvrelp.addRule(RelativeLayout.CENTER_HORIZONTAL, but.getId());
  rel.addView(tv, tvrelp);
  setContentView(rel);
  </code></pre>