title: GridView show only single Row in custom adapter?
body: <p>I am trying to add gridview dynamically with custom adapter but it is showing only sinle row</p>
  
  <p>I have tried WRAP_CONTENT,MATCH_PARENT,FILL_PARENT for height but it is not working for me </p>
  
  <p>if i am passing static height like 1000 then it is showing is there any solution for this</p>
  
  <p>//Grid View Code (mainLayout is my parent layout)</p>
  
  <pre><code>mParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
                  RelativeLayout.LayoutParams.WRAP_CONTENT);
          mParams.addRule(RelativeLayout.BELOW,playerSearchLayout.getId());
  
          grdPlayers=new GridView(getApplicationContext());
  
           grdPlayers.setLayoutParams(mParams);
  
           grdPlayers.setNumColumns(5);
           grdPlayers.setColumnWidth(GridView.AUTO_FIT);
           grdPlayers.setVerticalSpacing(5);
           grdPlayers.setHorizontalSpacing(5);
  
           mainLayout.addView(grdPlayers);  
  </code></pre>
  
  <p>//Adapter Coding</p>
  
  <pre><code>package customAdapters;
  
  import java.util.List;
  
  
  
  import PropertiesClasses.PlayerProperties;
  import android.app.Activity;
  import android.content.Context;
  import android.graphics.Color;
  import android.graphics.Typeface;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.AbsListView.LayoutParams;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.RadioButton;
  import android.widget.RadioGroup;
  import android.widget.RelativeLayout;
  import android.widget.TextView;
  
  public class PlayerAdapter extends BaseAdapter {
  
  
      private List&lt;PlayerProperties&gt; playerData;
      private Activity activity;
      private Context context;
  
  
      //Layouts
  
      RelativeLayout outerLayout;
      RelativeLayout playerDetailsLayout;
      RelativeLayout.LayoutParams params;
      ImageView userImage;
      TextView txtVotes;
      RadioButton radioVote;
  
      public PlayerAdapter(List&lt;PlayerProperties&gt; player,Activity activity,Context context)
      {
          playerData=player;
          this.activity=activity;
          this.context=context;
  
      }
  
  
  
      @Override
      public int getCount() {
          return playerData.size();
  
      }
  
      @Override
      public Object getItem(int position) {
          return position;
      }
  
      @Override
      public long getItemId(int position) {
          return position;
      }
  
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
  
          params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                  RelativeLayout.LayoutParams.WRAP_CONTENT);
          params.setMargins(10, 10, 10, 10);
          userImage=new ImageView(activity.getApplicationContext());
          userImage.setId(10000+position);
          userImage.setLayoutParams(params);
          userImage.setBackgroundResource(R.drawable.player);
  
          params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                  RelativeLayout.LayoutParams.WRAP_CONTENT);
          params.addRule(RelativeLayout.BELOW,userImage.getId());
          playerDetailsLayout=new RelativeLayout(activity.getApplicationContext());
          playerDetailsLayout.setId(11000+position);
          playerDetailsLayout.setBackgroundResource(R.drawable.greybg);
          playerDetailsLayout.setLayoutParams(params);
  
  
          params=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                  RelativeLayout.LayoutParams.WRAP_CONTENT);
          params.addRule(RelativeLayout.CENTER_HORIZONTAL);
          params.addRule(RelativeLayout.BELOW,playerDetailsLayout.getId());
          radioVote=new RadioButton(activity.getApplicationContext());
          radioVote.setId(17000+position);
          radioVote.setLayoutParams(params);
  
  
  
  
  
  
          outerLayout=new RelativeLayout(activity.getApplicationContext());
          outerLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));
  
  
          //outerLayout.addView(userImage);
          outerLayout.addView(userImage);
          outerLayout.addView(playerDetailsLayout);
          outerLayout.addView(radioVote);
  
          return outerLayout;
  
      }
  
  
  
  
  
  } 
  </code></pre>