天天看點

修改toolbar原生傳回鍵顔色

原文位址:http://stackoverflow.com/questions/26788464/how-to-change-color-of-the-back-arrow-in-the-new-material-theme/26837072#26837072

使用系統傳回鍵預設為黑色,修改 R.color.colorAccent為自己想要的顔色就能修改傳回鍵顔色

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_material);
upArrow.setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);      

或者在toolbar中加入主題

app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"      

這樣預設的箭頭顔色為白色

我認為,自定義主題,讓它的parent為上面那個,修改其中屬性應該也可以修改箭頭顔色,有待研究.      

繼續閱讀