0

I have the below toolbar:

<androidx.appcompat.widget.Toolbar
   android:id="@+id/my_account_top_bar"
   android:layout_width="match_parent"
   android:layout_height="60dp"
   android:orientation="horizontal"
   app:title="My Account"
   android:theme="@style/ToolbarTheme"/>

I want the back button to alternate between light/dark colours when switching between Day and Night modes, but setting the theme as above did not help, as it would for android.support.v7.widget.Toolbar.

Any ideas how I can change the back button colour using androidx?

Parth Lotia
  • 753
  • 1
  • 7
  • 25
George
  • 389
  • 5
  • 17

1 Answers1

2

You can use homeAsUpIndicator to change back button in your Theme like below:

<item name="homeAsUpIndicator">@drawable/ic_left_arrow</item>
Md. Asaduzzaman
  • 14,963
  • 2
  • 34
  • 46
  • Thanks, I just realised that my issue was setting `homeAsUpIndicator` inside the activity itself, instead of in styles.xml only. Although now, for some reason, the dark mode back button's horizontal line is cropped. Perhaps it's to do with me copying and pasting the original icon. – George Jan 13 '20 at 08:35