2012-02-14 107 views
0

我的TabHost出現問題,無法更改顏色。這裏是我的代碼:將顏色更改爲TabHost

intent = new Intent().setClass(this, DosageActivity.class); 
spec = tabHost 
     .newTabSpec("") 
     .setIndicator("Dosages", 
      res.getDrawable(android.R.drawable.ic_menu_manage)) 
     .setContent(intent); 
tabHost.addTab(spec); 

我試着寫在網站上幾種解決方案,但我不能做到這一點,我會保持相同的代碼。 預先感謝您

+0

好的......什麼顏色? – 2012-02-14 11:25:11

+0

嘗試http://stackoverflow.com/questions/9356546/is-it-possible-to-change-the-color-of-selected-tab-in-android?rq=1 – petey 2015-12-02 22:07:08

回答

0

覆蓋onTabChanged()然後拿到mTabHost.getCurrentTabView(),只是設置BackgroundResource的視圖view.setBackgroundResource()。對於更多,你可以檢查this答案。