0

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>

Toolbar:

<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"/>

i set the app:theme to this,but it always is black.if set @style/ThemeOverlay.AppCompat.Dark,it is grey.

other activity that don't custom is ok,but how to set the custom theme?

liquide
  • 1,346
  • 3
  • 20
  • 28
cs x
  • 621
  • 2
  • 8
  • 23

2 Answers2

3
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);
    }
Ram Prakash Bhat
  • 1,308
  • 12
  • 21
  • Does this mean that it's a bug? – cs x Apr 05 '16 at 08:59
  • No.. above code is useful when you required white color arrow in specific activity/fragment not in entire application. You can achieve this through themes: – Ram Prakash Bhat Apr 05 '16 at 09:07
  • The name of the resource was changed in the 23.2.0 support library. Modify abc_ic_ab_back_mtrl_am_alpha to abc_ic_ab_back_material – Salman khan Apr 16 '16 at 12:08
-1

Try this:

<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"/>

I.e. using @style/ThemeOverlay.AppCompat.Dark.ActionBar (instead of @style/ThemeOverlay.AppCompat.Dark) when setting the toolbar's app:theme.

eronisko
  • 1,862
  • 1
  • 15
  • 14