title: Programmatically Scrollable TableLayout
body: <p>I place 60 buttons in my <code>TableLayout</code> and these buttons exceeds the screen so I need a scroll to show remaining buttons. I have tried this code but application is not working. </p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TableLayout tableLayout;
        tableLayout = (TableLayout) findViewById(R.id.table_layout);
        TableRow tr;
        int buttonNumber = 0;
        for (int i =0;i&lt;30;i++)
        {
           tr = new TableRow(this);
           for (int j =0;j&lt;2;j++)
           {
              buttonNumber++;
              final Button btn = new Button(this);
              btn.setText("Button" + (buttonNumber));
              btn.setTag(buttonNumber);
              btn.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.MATCH_PARENT,1));
                  btn.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
  
                  }
              });
                  tr.addView(btn);
  
           }
                  tableLayout.addView(tr);
       }
              ScrollView sv = new ScrollView(this);
              sv.addView(tableLayout);
              super.setContentView(sv);
  }
  </code></pre>
  
  <p>How can I create a scrollable <code>TableLayout</code> programmatically? </p>