0

Refer to table looks I'm quite new to android development.I need to display dynamic list of data in table form. The image link above show a table contain a product image on relative left of the other table row field.

What kinds of combination tag should I use ? Noted that those items is dynamic "grow" based on database.

<LinerLayout>
   <tableLayout>
       <tableRow>  
          <image>...?
       </tableRow>
   </tableLayout>

   <tableLayout>
       <TableRow >                                   
            <TextView android:id="@+id/itemId" 
            android:text="@string/itemId"/>

       </TableRow>

       <TableRow >                                   
            <TextView android:id="@+id/name" 
            android:text="@string/name"/>/>

        </TableRow>

       <TableRow >                                   
        <TextView android:id="@+id/qty" 
            android:text="@string/qty"/>/>

        </TableRow>
   </tableLayout>
</LinerLayout>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user3354708
  • 57
  • 3
  • 9
  • 1
    Try with `ListView` with your Custom adapter which `extends BaseAdapter` instead of using of `TableLayout`. For this, try this links below: http://dj-android.blogspot.in/2012/10/android-show-data-from-sqlite-db-into.html, http://stackoverflow.com/questions/18201798/listview-display-the-data-from-database-in-android – The Heist Apr 04 '14 at 10:08
  • thank T-Rush advice,trying now. Regards – user3354708 Apr 05 '14 at 03:50
  • Image link is now dead making the question less clear. – Brian Tompsett - 汤莱恩 Nov 13 '16 at 23:11

1 Answers1

0

First of all create a layout for the table row and named it productsRow keep a parent layout <TableRow>. Now in your main layout just define the the tablelayout and get this view object in your activity class.

Run a loop upto the records list, render the productsRow layout created for a table row, set each view with a data, and add this tablerow to the tablelayout.

Always clear all views of an tablelayout if entering the fresh data or just keep add the tablerow if you want it to grow as with data.

Hope it will help you.

jitain sharma
  • 584
  • 5
  • 19