How can I set the colour of icons (home and overflow menu icon) in a Toolbar
/AppBarLayout
programmatically?
I want to change the toolbar's colour scheme for a single fragment in an activity. Setting the AppBarLayout
's background to a light colour (e.g. light gray with appBarLayout.setBackgroundResource(..);
) results in white icons and a white title which are barely visible.
Its layout is as follows:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ToolbarStyle"
app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>