2016-01-01 63 views
-1

我在堆棧溢出中遵循了很多答案,但仍然無法找到解決問題的方法。
我按照下面的鏈接來改變導航抽屜的顏色:
Navigation drawer change color在工具欄中更改導航抽屜圖標和溢出菜單圖標的顏色

我按照以下方法來改變溢流菜單的顏色:

<android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     style="@style/MyToolbarTheme.Base" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:minHeight="?attr/actionBarSize" 
     android:background="@color/colorPrimary" 
     app:titleTextColor="@android:color/white" 
     /> 

在Styles.XML

<style name="MyToolbarThemeSimple.Base" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="actionOverflowButtonStyle">@style/overflow_simple</item> 
    </style> 
    <style name="overflow_simple" parent="MyToolbarThemeSimple.Base"> 
     <item name="android:color">@color/windowBackground</item> 
     <item name="android:background">@color/windowBackground</item> 
    </style> 

我想將下面的導航抽屜和溢出菜單的顏色更改爲白色 enter image description here

+0

而不是父'Theme.AppCompat.Light.NoActionBar'使用'Theme.AppCompat.NoActionBar'。 –

+0

它不工作..... – ojas

回答

0

只需添加以下到您的MyToolbarThemeSimple.Base以適應溢出菜單點的顏色:

<style name="MyToolbarThemeSimple.Base" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="android:theme">@style/MyToolbarTheme</item> 
</style> 

<style name="MyToolbarTheme"> 
    <!-- Used to for the title of the toolbar --> 
    <item name="android:textColorPrimary">@android:color/white</item> 
    <!-- Used to color back button and overflow menu dots --> 
    <item name="android:textColorSecondary">@android:color/white</item> 
</style> 

對於ActionbarDrawerToggle您需要將drawerArrowStyle項目添加到您的AppTheme:

<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar"> 
    <!-- Other items --> 
    <item name="drawerArrowStyle">@style/MyDrawerArrowToggleStyle</item> 
</style> 

<style name="MyDrawerArrowToggleStyle" parent="Widget.AppCompat.DrawerArrowToggle"> 
    <item name="color">@android:color/white</item> 
</style> 
相關問題