android 自定义工具栏如何设置后退按钮为白色?

android custom toolbar how to set back button be white?

style/AppTheme:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowBackground">@color/colorBackground</item>
</style>

style/ActivityCustomToolbarTheme:

<style name="ActivityCustomToolbarTheme" parent="AppTheme">
   <item name="windowActionBar">false</item>
   <item name="windowNoTitle">true</item>
</style>

工具栏:

<android.support.v7.widget.Toolbar
     android:id="@+id/toolbar"
     android:layout_width="match_parent"
     android:layout_height="?attr/actionBarSize"
     app:layout_collapseMode="pin"
     app:theme="@style/ThemeOverlay.AppCompat.Light"/>

我把app:theme设置成这个,但它总是black.if设置@style/ThemeOverlay.AppCompat.Dark,它是灰色的。

其他activity不自定义也可以,但是如何设置自定义主题呢?

Use this

    protected void showBackButton() {
        mDrawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
        mDrawerToggle.setDrawerIndicatorEnabled(false);
        final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.ic_back); (R.drawable.ic_back==> your own drawable .png)
        mDrawerToggle.setHomeAsUpIndicator(upArrow);
        setSupportActionBar(mToolbar);
    }

试试这个:

<android.support.v7.widget.Toolbar
     android:id="@+id/toolbar"
     android:layout_width="match_parent"
     android:layout_height="?attr/actionBarSize"
     app:layout_collapseMode="pin"
     app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

即在设置工具栏的 app:theme.

时使用 @style/ThemeOverlay.AppCompat.Dark.ActionBar(而不是 @style/ThemeOverlay.AppCompat.Dark