1

도구 모음에서 내 햄버거/backarrow의 색상을 colorPrimaryDark에서 흰색으로 변경하고 싶습니다.햄버거/backarrow 도구 모음 색상 변경 안드로이드

내 style.xml 파일에서

나는이 개 테마가 :

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorPrimary</item> 
    <item name="colorButtonNormal">@color/white</item> 
    <item name="android:windowTranslucentStatus">true</item> 
</style> 


<!-- Toolbar theme. --> 
<style name="toolbar" parent="AppTheme"> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/white</item> 
    <item name="colorControlNormal">@color/white</item> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:textColorPrimary">@color/white</item> 
    <item name="android:textColor">@color/black</item> 
    <item name="android:textColorSecondary">@android:color/white</item> 
</style> 

을이 내 도구 모음입니다 :

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/toolbar" 
    android:fitsSystemWindows="true" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="@color/colorPrimary" 
    android:elevation="4dp" 
    android:theme="@style/toolbar"> 
</android.support.v7.widget.Toolbar> 

내가 여러 가지 방법과에서 <item name="android:textColorSecondary">@android:color/white</item> 이동됩니다에서만 작동하는 하나 시도 기본 테마 응용 프로그램 테마 도구 모음 테마.

기본 테마에서 textColorSecondary를 흰색으로 설정하면 다른 구성 요소 색도 변경되므로 저에게는 적합하지 않습니다. 내 도구 모음에만 설정하려고합니다. 그러나 내가 <item name="android:textColorSecondary">@android:color/white</item>이 있지만 심지어 일을하고 이상한 것은 다른 테마 색이 제대로 적용된다는 점이다 "android:theme="@style/toolbar"

enter image description here

enter image description here

사용하여 toolbar.xml에 내 도구 모음 스타일을 설정하지 않습니다.

어디서 잘못 되었나요?

+0

[이] (http://stackoverflow.com/questions/31870132/how-to-change-color-of-hamburger-icon-in-material-design-navigation-drawer)을 시도해 보셨습니까? – azizbekian

+0

예,하지만 햄버거 아이콘의 색상 만 변경되는 것은 아닙니다. 이유는 무엇입니까? – BitRulez

답변

1

해결책은 :이와

toolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_material); 

변경 햄버거 색상 :

내가이와 기본 화살표 아이콘을 설정

(하지만 난 우아한 해결책이 아니라 생각)

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorPrimary</item> 
     <item name="colorButtonNormal">@color/white</item> 
     <item name="drawerArrowStyle">@style/DrawerArrowStyle</item> 
</style> 

<style name="DrawerArrowStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle"> 
    <item name="spinBars">true</item> 
    <item name="color">@android:color/white</item> 
</style>