I am pretty new in Android, but I am an experienced developer.

I am trying to create a table that pretty much looks like this. The content is not important if you don't understand. I have pretty much solved it in the backend. I have retrieved the list and I have created TextViews for each of the columns.

![table](https://i.stack.imgur.com/A4fLD.png)

I find it very difficult to design such a page in Android.

I have tried creating a dynamic **TableLayout**. I tried using a layout file first as a template, and add to it dynamically but nothing was displayed. I have also tried to do everything programatically, but I haven't gotten that to work either.
I would like the view to be Scrollable vertically, but before adding more features I wanted the view to work first.

I can show sample of the code.

My layout.xml file

```
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:stretchColumns="0,1"
    tools:context=".TeamReportDetailActivity"
    android:id="@+id/reportDetailTableLayout">

</TableLayout>

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_team_report_detail); //my layout.xml
    //some code for getting the data from database
    putInTableLayout(theData);
}

private void putInTableLayout(ReportDetail rd) {
        TableLayout tl = (TableLayout) findViewById(R.id.reportDetailTableLayout);
        int totalAttGained = 0;

        for(int i = 0; i < mAllReports.size(); i++) {
            ReportDTO report = mAllReports.get(i);

             // Create a TableRow and give it an ID
            TableRow tr = new TableRow(this);
            tr.setLayoutParams(new LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));   
            tr.setId(1500+i);
            if(report.role.equalsIgnoreCase(GOALKEEPER)) {
                tr.setBackgroundColor(Color.BLUE);
            } else if(report.role.equalsIgnoreCase(DEFENDER)) {
                tr.setBackgroundColor(Color.GREEN);
            } else if(report.role.equalsIgnoreCase(MIDFIELDER)) {
                tr.setBackgroundColor(Color.GREEN);
            } else if(report.role.equalsIgnoreCase(ATTACKER)) {
                tr.setBackgroundColor(Color.RED);
            }
            TextView lblRole = new TextView(this);
            lblRole.setId(200+i);
            lblRole.setText(report.role);
            lblRole.setTextColor(Color.WHITE);
            lblRole.setLayoutParams(new LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));
            tr.addView(lblRole);

            //I add all these textviews and then finally I add it to the TableLayout
            // Add the TableRow to the TableLayout
            tl.addView(tr, new TableLayout.LayoutParams(
                LayoutParams.FILL_PARENT,
                LayoutParams.WRAP_CONTENT));

```

This code doesn't display anything. I would really appreciate help in designing a view that will display this table. Also, if anyone can suggest a good resource for learning how to design views in Android, that would be helpful.