I want to insert two table rows inside a table row vertically.
this is being done but the rows are being added horizontally instead of vertically.
How to add vertical rows..
Following is my xml.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/TableLAyout1"
>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<TableRow
android:layout_column="0"
android:layout_width="fill_parent"
android:background="@drawable/eventbar"
android:layout_height="wrap_content"
android:id="@+id/TableRow1" >
<TextView
android:gravity="center_vertical"
android:layout_width="wrap_content"
android:text="Calendar for 14 August 2011"
android:layout_height="wrap_content"
android:textColor="@drawable/white"
android:layout_marginLeft="10dp"
/>
</TableRow>
<TableRow
android:layout_column="0"
android:layout_below="@+id/TableRow1"
android:layout_width="fill_parent"
android:background="@drawable/bgrow"
android:layout_height="wrap_content">
<ListView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/ListView2" >
</ListView>
</TableRow>
</TableRow>
</TableLayout>
Can anyone help me how to this?
I think you misunderstood how
TableLayoutworks. If you read up in the tutorial you will see, that TableLayout works similarly to HTML tables, meaning thatTableRowactually defines a row, not a column and is not even intended to do otherwise. The columns are created automatically based on the views you add to the rows.Thus, if you want to have two rows with two
TextViewseach, you just add twoTableRows to yourTableLayout, and insert twoTextViews into each of them.