I would like to create a table of values, the table will have 2 columns, and N rows. The first row of the table will contain the headings, for example, "Height" and "Width", but I need these to be buttons. The next rows in the table will just contain text values, underneath their 'Height' and 'Width' headings, and these are populated using a class that extends BaseAdapter.
I don't know how to align the contents of the table to be aligned to the left edge of each heading button?
Currently I have something like this, but maybe I should be using a GridView? Or TableView?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:text="Height"
android:layout_height="wrap_content"
android:id="@+id/buttonHeight"
android:layout_width="wrap_content"
android:layout_weight="15">
</Button>
<Button
android:text="Width"
android:layout_height="wrap_content"
android:id="@+id/buttonWidth"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/buttonHeight"
android:layout_weight="1">
</Button>
</LinearLayout>
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:dividerHeight="1px"
android:drawSelectorOnTop="false"/>
</RelativeLayout>
Then my BaseAdapter inflates the following xml in order to assign the 'height' and 'width' to fill in all the row values, inside the overridden getView method:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/height"
android:textSize="10sp"
android:text="Height"
android:layout_weight="1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/width"
android:textSize="10sp"
android:text="Width"
android:layout_weight="1"/>
</LinearLayout>
Unfortunately the data simply does not line up with the button edges. How can I acheive this?