TabHost.TabSpec spec = tabs.newTabSpec("rycxtab");
        spec.setContent(R.id.rycxtab);
        spec.setIndicator("测试1",getResources().getDrawable(R.layout.infosearch_stress));
        tabs.addTab(spec);
        
        spec = tabs.newTabSpec("wpcxtab");
        spec.setContent(R.id.wpcxtab);
        spec.setIndicator("测试2",getResources().getDrawable(R.layout.infosearch_query_aticle));
        tabs.addTab(spec);
        
        spec = tabs.newTabSpec("ajcxtab");         spec.setContent(R.id.ajcxtab);
        spec.setIndicator("测试3",getResources().getDrawable(R.layout.infosearch_law_case));
        tabs.addTab(spec);
        
        spec = tabs.newTabSpec("jgcxtab");
        spec.setContent(R.id.jgcxtab);
        spec.setIndicator("测试4",getResources().getDrawable(R.layout.infosearch_institution));
        tabs.addTab(spec); 
        
        tabs.setCurrentTab(0);

解决方案 »

  1.   

    getResources().getDrawable(R.layout.infosearch_stress) 这个地方不报错
      

  2.   

    getResources().getDrawable(R.layout.infosearch_stress)这些有问题吧!图片放在drawable文件夹下!
    应该是:getResources().getDrawable(R.id.infosearch_stress);几个选项卡都有问题哦!!
    楼主看看吧!!
      

  3.   

    R.layout.infosearch_stress  这个是加载xml