Skip to content Skip to sidebar Skip to footer

How To Make A Dynamic Table Layout Using Xml

I want to make a table layout as shown in the below screen: I am able to make this UI using the code. But I want to make it using the XML. I tried the following approach. I trie

Solution 1:

from looking at the image i would suggest taking the list view route. have your layout as

R1Col1     R1Col2     R1Col3
R2 Looooong Col1

this should workout well for you.

UPDATE

you list_item.xml should look something like this.

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/wrapper"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical"><LinearLayoutandroid:id="@+id/wrapper"android:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="horizontal"><TextViewandroid:id="@+id/tv1"android:text="column1"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:id="@+id/tv2"android:text="column2"android:layout_width="wrap_content"android:layout_height="wrap_content"/><TextViewandroid:id="@+id/tv3"android:text="column3"android:layout_width="wrap_content"android:layout_height="wrap_content"/></LinearLayout><TextViewandroid:id="@+id/tv1"android:layout_width="fill_parent"android:layout_height="wrap_content"android:text="short description text for Title 0 comes here" /></LinearLayout>

here is a sample to learn how to populate a ListView

ListView Example

Solution 2:

Why you need two different rows ?

You can integrate two rows in one Xml and so you have only one row to add in table view

Post a Comment for "How To Make A Dynamic Table Layout Using Xml"