将汉堡图标的颜色更改为android工具栏

时间:2017-02-22 11:20:30

标签: android android-toolbar

我已将工具栏集成到主要活动中,现在我想更改图标berger的颜色和项目菜单的背景颜色:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent" android:layout_height="wrap_content"
    android:id="@+id/toolbar"
    android:fitsSystemWindows="true"
    android:theme="@style/toolbar"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

</android.support.v7.widget.Toolbar>

并且样式文件是:

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
</resources>

1 个答案:

答案 0 :(得分:3)

尝试使用:

 <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:id="@+id/toolbar"
    android:fitsSystemWindows="true"
    app:theme="@style/backArrowTheme"
    app:popupTheme="@style/AppTheme"
   >    
</android.support.v7.widget.Toolbar>


<style name="backArrowTheme" parent="AppTheme">
    <item name="android:textColorSecondary">Hexcode of color</item>
</style>