public TabHostAssert hasCurrentTab(int tab) { isNotNull(); int actualTab = actual.getCurrentTab(); assertThat(actualTab) // .overridingErrorMessage("Expected current tab <%s> but was <%s>.", tab, actualTab) // .isEqualTo(tab); return this; }
public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FF0000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected }
@Test public void canGetCurrentTab() throws Exception { TabHost tabHost = new TabHost(context); TabHost.TabSpec foo = tabHost.newTabSpec("Foo"); TabHost.TabSpec bar = tabHost.newTabSpec("Bar"); TabHost.TabSpec baz = tabHost.newTabSpec("Baz"); tabHost.addTab(foo); tabHost.addTab(bar); tabHost.addTab(baz); assertThat(shadowOf(tabHost).getCurrentTabSpec()).isEqualTo(foo); assertThat(tabHost.getCurrentTab()).isEqualTo(0); tabHost.setCurrentTabByTag("Bar"); assertThat(tabHost.getCurrentTab()).isEqualTo(1); assertThat(shadowOf(tabHost).getCurrentTabSpec()).isEqualTo(bar); tabHost.setCurrentTabByTag("Foo"); assertThat(tabHost.getCurrentTab()).isEqualTo(0); assertThat(shadowOf(tabHost).getCurrentTabSpec()).isEqualTo(foo); tabHost.setCurrentTabByTag("Baz"); assertThat(tabHost.getCurrentTab()).isEqualTo(2); assertThat(shadowOf(tabHost).getCurrentTabSpec()).isEqualTo(baz); }
...onCreate(){ ... tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String arg0) { setTabColor(tabHost); } }); setTabColor(tabHost); ... } //Change The Backgournd Color of Tabs public void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) tabhost.getTabWidget().getChildAt(i).setBackgroundColor(COLOR_CYAN); //unselected if(tabhost.getCurrentTab()==0) tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(COLOR_RED); //1st tab selected else tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(COLOR_BLUE); //2nd tab selected }
@Override public void onTabChanged(String tabId) { int position = mTabHost.getCurrentTab(); mViewPager.setCurrentItem(position); onFragmentChange(position); }
//Change The Backgournd Color of Tabs public void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(COLOR_CYAN); } //unselected if(tabhost.getCurrentTab()==0){ tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(COLOR_RED); //1st tab selected } else { tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(COLOR_BLUE); //2nd tab selected } }
public TabHostAssert hasCurrentTab(int tab) { isNotNull(); int actualTab = actual.getCurrentTab(); assertThat(actualTab) // .overridingErrorMessage("Expected current tab <%s> but was <%s>.", tab, actualTab) // .isEqualTo(tab); return this; }
your_tabhost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(final String tabId) { final TabHost th = (TabHost) findViewById(android.R.id.tabhost)); final LinearLayout lLayout = (LinearLayout) th.getTabWidget().getChildTabViewAt(th.getCurrentTab()); ViewGroup.LayoutParams curParams = lLayout.getLayoutParams(); lLayout.setLayoutParams(new FrameLayout.LayoutParams(curParams.width, (int) (curParams.height * 1.20))); } });
@Override public boolean onLongClick(View v) { if (mainActivity.getTabHost().getCurrentTab() == MainActivity.tabMain) { mChartOption.performClick(); } return false; } }
@Override public MonthAdapter.CalendarDay getSelectedDay() { if (tabHost.getCurrentTab() == 1) { return new MonthAdapter.CalendarDay(mPersianDate); } else { return new MonthAdapter.CalendarDay(mPersianDateEnd); } }
//Change The Backgournd Color of Tabs public void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FFFFFF"))); //unselected white colored } if(!what.equals("disappear")) tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("FF0000"))); // selected red colored else tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("FFFFFF"))); // selected but show as unselected with white color }
tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override public void onTabChanged(String tabId) { MyClass.setTabColor(tabHost); } }); public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_bg); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundResource(R.drawable.tab_bg_selected); // selected }
public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundResource(R.color.white); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundResource(R.color.tab_selected); // selected }
public static void setTabColor(TabHost tabhost) { for (int i = 0; i < tabhost.getTabWidget().getChildCount(); i++) { tabhost.getTabWidget().getChildAt(i) .setBackgroundColor(Color.parseColor("#292929")); // unselected // } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()) .setBackgroundColor(Color.parseColor("#8b8b8b")); // selected } }
public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FF0000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected }
public static void setTabColor(TabHost tabhost) { for (int i = 0; i < tabhost.getTabWidget().getChildCount(); i++) { tabhost.getTabWidget().getChildAt(i) .setBackgroundColor(Color.parseColor("#434a54")); // unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()) .setBackgroundColor(Color.parseColor("#22262c")); // selected }
public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FF0000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected
public static void setTabColor(TabHost tabhost) { for(int index=0;index<tabhost.getTabWidget().getChildCount();index++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#477a47")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected }
public static void setTabColor(TabHost tabhost) { for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) { tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FF0000")); //unselected } tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected }
public static void setTabColor(TabHost tabhost) { for (int i = 0; i < tabhost.getTabWidget().getChildCount(); i++) { tabhost.getTabWidget().getChildAt(i) .setBackgroundResource(R.drawable.header_blank); // unselected } tabhost.getTabWidget().setCurrentTab(0); tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()) .setBackgroundResource(R.drawable.tab_selected_new); // selected // //have // to // change }