@Test public void shouldAddTabsToLayoutWhenAddedToHost() { TabHost tabHost = new TabHost(context); View fooView = new View(context); TabHost.TabSpec foo = tabHost.newTabSpec("Foo").setIndicator(fooView); View barView = new View(context); TabHost.TabSpec bar = tabHost.newTabSpec("Bar").setIndicator(barView); tabHost.addTab(foo); tabHost.addTab(bar); assertThat(tabHost.getChildAt(0)).isSameAs(fooView); assertThat(tabHost.getChildAt(1)).isSameAs(barView); }
// light theme support final TabHost tabHost = getTabHost(); tabHost.setBackgroundColor(Color.WHITE); tabHost.getTabWidget().setBackgroundColor(Color.BLACK); // hack to set font size LinearLayout ll = (LinearLayout) tabHost.getChildAt(0); TabWidget tw = (TabWidget) ll.getChildAt(0); // first tab RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0); lf = (TextView) rllf.getChildAt(1); lf.setTextSize(21); lf.setPadding(0, 0, 0, 6); // second tab RelativeLayout rlrf = (RelativeLayout) tw.getChildAt(1); rf = (TextView) rlrf.getChildAt(1); rf.setTextSize(21); rf.setPadding(0, 0, 0, 6);
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0); TabWidget tw = (TabWidget) ll.getChildAt(0);
TabWidget tw = (TabWidget) tabHost.getChildAt(1);
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0); TabWidget tw = (TabWidget) ll.getChildAt(0);
( (FrameLayout) ( (android.widget.LinearLayout) tabHost.getChildAt( 0 ) ).getChildAt( 1 ) ).addView( newLayout );
View view = mTabHost.getChildAt(0); new DefeitoFalhaView().getDadosDefeitoFalha(view);
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0); TabWidget tw = (TabWidget) ll.getChildAt(0);