我试图更改工具栏图标,例如Image 01至Image 02以及类似的后退图标。
我可以使用以下方式更改默认图标的颜色
<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>
我已经尝试过:
toolbar=findViewById(R.id.toolBarId);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_right_select);
但现在可以工作。有什么办法可以解决styles.xml文件?
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.drawable.ic_arrow_right_select);