title: Android - dynamic gridview (multiple columns binded rows)
body: <p>I would like to implement a gridview within Android, which will basically consist of 4 columns (it will be actiing similary to a table).</p>
  
  <p>This will essentially be a list of items spread across 4 columns (name, qty, p1, p2). So each row contains 4 columns is unique to 1 items. Therefore, I need a way to bind these 4 columns together so that when i select anywhere within those 4 columns the whole row will be selected, whilst returning the 'name' column as the text id.</p>
  
  <p>Is there an easy way that this can be done? This is my current code for the gridView:</p>
  
  <p>XML Layout:</p>
  
  <pre><code>&lt;GridView
      android:id="@+id/gvShopCompleteList"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_below="@+id/spnShopCharacters"
      android:layout_above="@+id/linerBuyBtns"
      android:numColumns="1"
      android:fastScrollEnabled="true"
      android:scrollbarStyle="insideOverlay"&gt;
  &lt;/GridView&gt;
  </code></pre>
  
  <p>Binding of Dynamic content:</p>
  
  <pre><code>GridView gridview;
  static final String[] listItems = new String[] { "name","qty","p1","p2","itemname","5","100","1" };
  gridview = (GridView)findViewById(R.id.gvShopCompleteList);
  ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, listItems);
  gridview.setAdapter(adapter);
  
  gridview.setOnItemClickListener(new OnItemClickListener() 
  {
      public void onItemClick(AdapterView&lt;?&gt; parent, View v,int position, long id) 
      {
          Toast.makeText(getApplicationContext(),
          ((TextView) v).getText(), Toast.LENGTH_SHORT).show();
      }
  });
  </code></pre>
  
  <p>Finally, an additional feature I would like to add is to make the header read only and highlighted a different color to the other rows. Any help would be much appreciated here, I do not have to use GridView, but would like to keep the generic android look as much as possible (consistant throughout my app). Thanks.</p>