0

I trying to change the toolbar icons like Image 01 to Image 02 and similarly the back icon.

I am able to change the default icons color using

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/whit</item>
    <item name="colorPrimaryDark">@color/whit</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="drawerArrowStyle">@style/IconStyle</item>
</style>

<style name="IconStyle" parent="@style/Widget.AppCompat.DrawerArrowToggle">
    <item name="spinBars">true</item>
    <item name="color">@color/name_heading</item>
</style>

I already try:

toolbar=findViewById(R.id.toolBarId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_right_select);

but now work. Is there any way to solve it from the styles.xml file?

HasanToufiqAhamed
  • 751
  • 1
  • 5
  • 17

2 Answers2

2
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_arrow_right_select);
M0nst3R
  • 5,186
  • 1
  • 23
  • 36
Kishan Maurya
  • 3,356
  • 8
  • 21
0

In kotlin:

supportActionBar!!.setHomeAsUpIndicator(R.drawable.ic_back)