2016-11-07 301 views
1

如何改變對AppBar按鈕的顏色?在我的情況後退按鈕,默認顏色爲白色更改顏色的按鈕

enter image description here

,但我得到我的,我想改變黑色到白色嘗試與口音顏色,仍然沒有改變我。 我使用的工具欄

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

+0

向你展示xml和java代碼,所以人工智能可以幫助你 –

+0

https://www.google.co.in/ #Q =變化+ homeasupindicator +編程+機器人 – pRaNaY

回答

0
在新版本

的Android使用的材料設計的後退按鈕,你可以改變顏色過濾器,並設置爲後退按鈕

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);