Gunnar Gunnar - 1 month ago 7
Android Question

Change color buttons on Android AppBar

How to change the color of the buttons on the AppBar ?, in my case the back button, the default color is white
enter image description here

But I get mine and I want to change black to white try with accent colors and still not change me.
I am using toolbar

<?xml version="1.0" encoding="utf-8"?>




<android.support.design.widget.AppBarLayout
android:id="@+id/toolbar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="4dp"
app:layout_scrollFlags="scroll|enterAlways" />

<android.support.design.widget.TabLayout
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/toolbar1"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/toolBarTheme" />

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />



Answer

in new versions android uses material design for the backbutton , you can change the colour filter and set that as the back button

  final Drawable backArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    backArrow.setColorFilter(getResources().getColor(R.color.grey), PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setHomeAsUpIndicator(backArrow);