How to change option menu icon in the action bar? How to change option menu icon in the action bar? android android

How to change option menu icon in the action bar?


The following lines should be updated in app -> main -> res -> values -> Styles.xml

 <!-- Application theme. --><style name="AppTheme" parent="AppBaseTheme">    <!-- All customizations that are NOT specific to a particular API-level can go here. -->    <item name="android:actionOverflowButtonStyle">@style/MyActionButtonOverflow</item></style><!-- Style to replace actionbar overflow icon. set item 'android:actionOverflowButtonStyle' in AppTheme --><style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.Light.ActionButton.Overflow">    <item name="android:src">@drawable/ic_launcher</item>    <item name="android:background">?android:attr/actionBarItemBackground</item>    <item name="android:contentDescription">"Lala"</item></style>

This is how it can be done. If you want to change the overflow icon in action bar


I got a simpler solution which worked perfectly for me :

Drawable drawable = ContextCompat.getDrawable(getApplicationContext(),R.drawable.change_pass);        toolbar.setOverflowIcon(drawable);


//just edit menu.xml file    //add icon for item which will change default setting icon//add sub menus ///menu.xml file    <item            android:id="@+id/action_settings"            android:orderInCategory="100"            android:title="@string/action_settings"            android:icon="@drawable/your_icon"            app:showAsAction="always" >            <menu>                <item android:id="@+id/action_menu1"                    android:icon="@android:drawable/ic_menu_preferences"                    android:title="menu 1" />                <item android:id="@+id/action_menu2"                    android:icon="@android:drawable/ic_menu_help"                    android:title="menu 2" />            </menu>        </item>