1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| // Définition du Layout à construire.
LinearLayout postLayout = new LinearLayout( this );
// Définition du composant Text.
TextView txvName = new TextView( this );
txvName .setText(String. format (getString(R.string. wall_name ), post .getString( "name" )));
txvName .setTypeface(Typeface. defaultFromStyle (Typeface. BOLD ));
//Définition de la façon dont le composant va remplir le layout.
LinearLayout.LayoutParams layoutParam = new LinearLayout.LayoutParams(LinearLayout.LayoutParams. FILL_PARENT , LinearLayout.LayoutParams. WRAP_CONTENT ) ;
layoutParam.setMargins(30, 20, 30, 0);
//Ajout du composant au layout.
postLayout .addView( txvName , layoutParam ); |
Partager