1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| int current =1321;
newDev =(Button) findViewById(R.id.btNew);
tabNote = (TableLayout) findViewById(R.id.tabN);
tabL= new TableRow(this);
tabL.setOrientation(1);
tabL.setId(100+current);
tabL.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
));
// 1er TextView
text= new TextView(this);
text.setId(50+current);
text.setText("Toto");
text.setTextColor(Color.BLACK);
text.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
));
// Ajouter à la colonne
tabL.addView(text);
text= new TextView(this);
text.setId(100+current);
text.setText("Toto2");
text.setTextColor(Color.BLACK);
text.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
));
// Ajouter à la colonne
tabL.addView(text);
// Ajouter au Tableau
tabNote.addView(tabL, new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
)); |
Partager