title: MonoDroid Displaying database fields with horizontal scrollbar
body: <p>I have a table with about 20 columns and number of records which will vary from 5-20+.  I want to display all of this data on the screen using horizontal and vertical scrollbars.  I'm torn on what method would be best in order to do this.  I've started on a listview solution but have kind of gotten stuck.  The following is the XML for my layout (ive condensed the table rows but you get the idea)..</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/LinearLayout1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
      &lt;Button
          android:id="@+id/btnHome"
          style="@style/homeButton"
          android:layout_width="200dp"
          android:layout_height="wrap_content"
          android:layout_marginTop="5dp"
          android:gravity="center"
          android:text="@string/btnHomeText"
          android:textColor="@color/white"
          android:textStyle="bold" /&gt;
      &lt;RelativeLayout
          android:id="@+id/InnerRelativeLayout2"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/btnHome"&gt;
          &lt;LinearLayout
              style="@style/stdWindow"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_marginBottom="5dp"
              android:layout_marginLeft="5dp"
              android:layout_marginRight="5dp"
              android:baselineAligned="false"
              android:orientation="vertical"&gt;
              &lt;TextView
                  android:id="@+id/tvDriverReport"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginLeft="5dp"
                  android:layout_marginRight="5dp"
                  android:background="@color/VeryDarkGray"
                  android:text="@string/futureFeatureText"
                  android:textAppearance="?android:attr/textAppearanceLarge"
                  android:textColor="@color/OMSGold" /&gt;
              &lt;TableLayout
                  android:minWidth="25px"
                  android:minHeight="25px"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:id="@+id/tableLayout1"&gt;
                  &lt;TableRow
                      android:id="@+id/tableRow1"&gt;
                      &lt;TextView
                          android:text="@string/summaryTicketNumber"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="0"
                          android:id="@+id/textView10" /&gt;
                      &lt;TextView
                          android:text="@string/summaryDate"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="1"
                          android:id="@+id/textView11" /&gt;
                      &lt;TextView
                          android:text="@string/summaryTruckNumber"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="2"
                          android:id="@+id/textView12" /&gt;
                      &lt;TextView
                          android:text="@string/summaryBeginOdometer"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="3"
                          android:id="@+id/textView21" /&gt;
                      &lt;TextView
                          android:text="@string/summaryEndOdometer"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="4"
                          android:id="@+id/textView22" /&gt;
                  &lt;/TableRow&gt;
                  &lt;TableRow
                      android:id="@+id/tableRow2"&gt;
                      &lt;TextView
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="0"
                          android:id="@+id/tvTicketNumber" /&gt;
                      &lt;TextView
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="1"
                          android:id="@+id/tvSummaryDate" /&gt;
                      &lt;TextView
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="2"
                          android:id="@+id/tvTruckNumber" /&gt;
                      &lt;TextView
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:layout_column="3"
                          android:id="@+id/tvBeginOdometer" /&gt;
                      &lt;TextView
                          android:layout_column="4"
                          android:textAppearance="?android:attr/textAppearanceMedium"
                          android:id="@+id/tvEndOdometer" /&gt;
                  &lt;/TableRow&gt;
              &lt;/TableLayout&gt;
          &lt;/LinearLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>So basically table row 1 is static heading data but every row after that will be dynamically populated from the database, so the number of rows will be variable.</p>
  
  <p>I started on the custom list adapter solution but cant seem to get it working.  Here is my customlistadapter</p>
  
  <pre><code>    public class CustomListAdapter : BaseAdapter
      {
          Activity context;
  
          public List&lt;TicketSummaryMapper&gt; items;
  
          public CustomListAdapter (Activity context)
              : base()
          {
              this.context = context;
              var db = new SQLiteConnection (db);
              items = db.Query&lt;TicketSummaryMapper&gt; ("select * from mydatabase");
  
          }
  
          public override int Count
          {
              get { return items.Count; }
          }
  
          public override Java.Lang.Object GetItem(int position)
          {
              return position;
          }
  
          public override long GetItemId(int position)
          {
              return position;
          }
  
          public override View GetView (int position, View convertView, ViewGroup parent)
          {
  
              var item = items [position];            
  
  
              var view = (convertView ?? 
                  context.LayoutInflater.Inflate (
                      Resource.Layout.ticket_summary, 
                      parent, 
                      false)) as LinearLayout;
  
              //Find references to each subview in the list item's view
              var textTicketNo = view.FindViewById (Resource.Id.tvTicketNumber) as TextView;
              var textSummaryDate = view.FindViewById (Resource.Id.tvSummaryDate) as TextView;
              var textTruckNumber = view.FindViewById (Resource.Id.tvTruckNumber) as TextView;
              var textBeginOdometer = view.FindViewById (Resource.Id.tvBeginOdometer) as TextView;
  
  
  
              //Assign this item's values to the various subviews
              textTicketNo.SetText (item.TicketNumber, TextView.BufferType.Normal);
              textSummaryDate.SetText (item.TransDate, TextView.BufferType.Normal);
              textTruckNumber.SetText (item.EquipmentNo, TextView.BufferType.Normal);
              textBeginOdometer.SetText (item.BeginOdometer, TextView.BufferType.Normal);
  
              //Finally return the view
              return view;
          }
  
          public TicketSummaryMapper GetItemAtPosition(int position)
          {
              return items[position];
          }
      }
  </code></pre>
  
  <p>and then finally my activity...</p>
  
  <pre><code>[Activity (Label = "AdminActivity")]            
  public class AdminActivity : Activity
  {
      CustomListAdapter listAdapter;
      public AdminActivity() { }
      public AdminActivity(IntPtr handle, JniHandleOwnership transfer) : base(handle,           transfer) { }
  
  
      protected override void OnCreate (Bundle bundle)
      {
          base.OnCreate (bundle);
  
          //Set the Activity's view to our list layout        
          SetContentView (Resource.Layout.customlist);
  
          //Create our adapter
          listAdapter = new CustomListAdapter (this);
  
          //Find the listview reference
          var listView = FindViewById&lt;ListView&gt; (Resource.Id.listView);
  
          //Hook up our adapter to our ListView
          listView.Adapter = listAdapter;
      }
      }
  </code></pre>
  
  <p>the customlist layout basically just has a linearlayout followed by a listview and thats it.  thanks for taking the time to look at this...</p>