2014-06-06 40 views
-1

我想改變選項卡背景,指示器顏色和我的操作欄選項卡的文本顏色的顏色,但我似乎無法弄清楚。在android中的自定義的操作欄選項卡

這裏是我的一些相關的代碼。

styles.xml

<resources> 

    <!-- 
     Base application theme, dependent on API level. This theme is replaced 
     by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 

    --> 
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> 
     <!-- 
      Theme customizations available in newer API levels can go in 
      res/values-vXX/styles.xml, while customizations related to 
      backward-compatibility can go here. 

     --> 
    </style> 

    <!-- Application theme. --> 
    <style name="AppTheme" parent="AppBaseTheme"> 
     <!-- All customizations that are NOT specific to a particular API-level can go here. --> 
    </style> 

</resources> 

MainActivity.java

actionBar = getActionBar(); 
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.actionBarBG))); 
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); 
actionBar.setDisplayShowTitleEnabled(true); 

android.app.ActionBar.Tab tab1 = actionBar.newTab().setText("Unposted") 
       .setTabListener(VisitDates.this); 

android.app.ActionBar.Tab tab2 = actionBar.newTab().setText("Posted") 
       .setTabListener(VisitDates.this); 

android.app.ActionBar.Tab tab3 = actionBar.newTab() 
       .setText("All visits").setTabListener(VisitDates.this); 

actionBar.addTab(tab1); 
actionBar.addTab(tab2); 
actionBar.addTab(tab3); 
actionBar.selectTab(tab1); 

回答

0

我發現傑夫Gilfelt here做出這個動作條主題發電機。非常有用的工具。只需設置你想要的設計下載文件,將它們複製並粘貼到項目的res文件夾中即可完成。

確保您在構建或測試應用程序之前首先清理您的項目。