Code example for TabHost.TabSpec

Methods: setContent, setIndicator

0
     
    private void addTabCompletades() { 
         Intent intent = new Intent(this, FinishedCatTaskOverviewActivity.class);
         intent.putExtra("id", id);
         TabSpec spec = mTabHost.newTabSpec("Completades");
         spec.setIndicator("Completades", mResources
                           .getDrawable(android.R.drawable.ic_menu_agenda));
         spec.setContent(intent);
         mTabHost.addTab(spec);
     } 
     
    public void onTabChanged(String tabId) {
         
        for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
            mTabHost.getTabWidget().getChildAt(i).setBackgroundColor(
                    Color.parseColor("#493733"));
        } 
        mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab())
                .setBackgroundColor(Color.parseColor("#ff5224"));
      
Contextual code suggestions in your IDE  Get Codota for Java