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 38 39 40 41 42
   | LinearLayout.LayoutParams params1= new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
		LinearLayout.LayoutParams params2= new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
 
		LinearLayout layoutGlobal= new LinearLayout(context);
		layoutGlobal.setLayoutParams(params1);
 
 
		LinearLayout sousLayout = new LinearLayout(context);
		sousLayout.setLayoutParams(params1);
 
 
		TabHost mtab= new TabHost(context);
		mtab.setLayoutParams(params1);
 
		TabWidget tabs= new TabWidget(context);
		tabs.setLayoutParams(params2);
 
 
		FrameLayout content = new FrameLayout(context);
		content.setLayoutParams(params1);
 
 
 
		sousLayout.addView(tabs);
		sousLayout.addView(content);
 
		mtab.addView(sousLayout);
 
 
		TabSpec tab = mtab.newTabSpec("onglet1").setIndicator("onglet1").setContent(new TabContentFactory() {
			public View createTabContent(String tag) {
 
				LinearLayout ll1=new LinearLayout(context);
				TextView tv= new TextView(context);
				tv.setText("text");
				ll1.addView(tv);
 
				return ll1;}		
		});
		mtab.addTab(tab);
 
		layoutGlobal.addView(mtab); | 
Partager