I show a TableLayout with Data, the first row is the columns' name and since the second row is data, i need to pin up the first row but i have to be scrollable horizontally with the data(others rows) not vertically, but the data(others rows) just the data, have to be both(horizontally and vertically), because a i need to see always the columns' name.
I make my tablelayout like this:
TableLayout table= (TableLayout) findViewById(R.id.table);
//columns' name (first row)
TableRow column= new TableRow(this);
for(int i=0;i<lenght; i++){
TextView columnName = new TextView(this);
columnName.setText("Column "+i);
column.addView(columnName);
}
table.addView(column); //with this i add the first row with columns' name
//Data
for(int i=0;i<lenght; i++){
TableRow rowData = new TableRow(this);
TextView data= new TextView(this);
data.setText("data "+i);
rowData .addView(data);
table.addView(rowData );//add rows(since the second row)
}
With this structure i scroll all the tablelayout:
->ScrollView
->HorizontalScrollView
->TableLayout