Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have to create a table like the following one in xml,</p> <pre><code>&lt;TableLayout android:id="@+id/rows_table" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="10dip" android:layout_marginTop="10dip" android:padding="10dp" android:background="color or drawable" android:shrinkColumns="*" android:stretchColumns="*"/&gt; </code></pre> <p>and declare the table in your code,</p> <pre><code>RowsTable = (TableLayout) findViewById(R.id.rows_table); </code></pre> <p>and you can do the following in <code>AsyncTask PostExcute</code> or somewhere you wish to,</p> <pre><code>// entries are the no.of that you decided to print dynamically. int rows; for (rows=0;rows&lt;entries.length();rows++) { TableRow trTwo = new TableRow(Activity.this); trTwo.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.FILL_PARENT)); // Here you can get the cursor data , which is going to be displayed in the coloumns. //entriesVar is the coloumn data. for(int coloumn = 2; coloumn &lt; entriesVar.length; coloumn++) { //Your database values if (coloumn == 1) { //Any Header options, If you wish to show any table headers } String questionable = "sometext"; TextView txtTwo = new TextView(ReportsActivity.this); txtTwo.setText(questionable); txtTwo.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); txtTwo.setTextColor(Color.BLACK); txtTwo.setGravity(Gravity.CENTER); txtTwo.setBackgroundResource(R.drawable.table_border_new); txtTwo.setPadding(3, 3, 3, 3); trTwo.addView(txtTwo);// Binding Text To Row } // Adding View To Table RowsTable.addView(trTwo, new TableLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload