我如何更改android工具栏主页图标

问题描述 投票:0回答:1

我试图更改工具栏图标,例如Image 01Image 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文件?

android android-studio icons toolbar titlebar
1个回答
0
投票
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_right_select);
© www.soinside.com 2019 - 2024. All rights reserved.