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
|
public void methode_f3(int m3) {
Integer i3 = m3;
TextView textDynamic = new TextView(this);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
textDynamic.setLayoutParams(lp);
textDynamic.setText("Valeur de i3 : "+ i3.toString());
//textDynamic.setBackgroundColor(Color.GREEN);
textDynamic.setTextColor(Color.BLUE);
//textDynamic.setTextScaleX(2);
textDynamic.setTextSize(20);
//textDynamic.isClickable();
textDynamic.setGravity(Gravity.BOTTOM);
textDynamic.setPadding(10, 10, 10, 10);
FragmentTransaction aft32 = afm.beginTransaction();
mFragment2 = (Fragment2) afm.findFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new Fragment2();
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = (View) vi.inflate(R.layout.fragment2, null);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.autreactivity_fragment2);
ll.addView(textDynamic);
aft32.add(R.id.Container_fragment2,mFragment2,"f2");
}
else {
LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = (View) vi.inflate(R.layout.fragment2, null);
LinearLayout ll = (LinearLayout) v.findViewById(R.id.autreactivity_fragment2);
ll.addView(textDynamic);
aft32.replace(R.id.Container_fragment2,mFragment2);
}
aft32.addToBackStack(null);
aft32.commit();
} |