Dynamic.xml file
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
>
<TableLayout android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/abc" >
</TableLayout>
</ScrollView>
Dynamic.javaFile
package com.example.checkbox;
import android.annotation.SuppressLint;
import android.app.ActionBar.LayoutParams;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class MainActivity extends Activity {
TableLayout tl;
private CheckBox checkBox;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tl=(TableLayout)findViewById(R.id.abc);
for(int i=0; i<10; i++)
{
TableRow tr=new TableRow(this);
tl.addView(tr);
for(int k=0; k<10; k++)
{
TextView tv=new TextView(this);
tv.setText("TESTing ");
tv.setId(i);
tr.addView(tv);
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
Dynamic Output