0

I want to change default icon(where user can click and toggle the menus) from toolbar. My code is as bellow:

navigation_bar.xml

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:background="@color/bluebg"
        android:layout_width="match_parent"

        android:layout_height="?attr/actionBarSize"
        app:navigationIcon="@drawable/menu"
/> 

for this I have setup the style as bellow:

 <style name="AppTheme" 
    parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/MenuBarStyle</item>
</style>

<style name="MenuBarStyle" parent="android:style/Widget.Holo.Light.ActionButton.Overflow"> 
<item name="android:src">@drawable/right_icone</item>
</style>

with above code I successfully changed the right side icon but i also wants to change left side icon to.

I have tired with following solutions.

  1. How do I change the android actionbar title and icon

  2. android action bar customize icons

I wants to change user icon from bellow image. https://i.stack.imgur.com/KTh3d.jpg

Tanay Sharma
  • 1,098
  • 10
  • 29
Create Explorer
  • 357
  • 2
  • 20
  • why don't you try using custom toolbar ? and if you want to change just the navigation icon change this to your desired icon : `app:navigationIcon="@drawable/you desired icon"` – Umair Mar 11 '19 at 13:47
  • Using the code: app:navigationIcon="@drawable/you_desired , it add another Icon after the existing icon, – Create Explorer Mar 11 '19 at 13:57
  • 1
    then you need to hide default navigation Icon first. Then you will only see your custom icon. See the following link on how to hide it https://stackoverflow.com/questions/47572122/how-to-hide-default-hamburger-icon-of-navigation-view-android. Or you can simply set toolbar.setNavigationIcon(null); – Umair Mar 11 '19 at 13:59
  • Yes, your comments really assit me to reach the actual issue, from your link the code: toggle.setDrawerIndicatorEnabled(false); hide the default icon than rest code will do the toggle action. but here is this possible to replace default DrawerIndicator icon from toolbar? – Create Explorer Mar 11 '19 at 14:14
  • yes it is possible. For that you need to make your custom toolbar. – Umair Mar 11 '19 at 14:25

0 Answers0