You can use android:actionLayout or android:actionViewClass so that the menu items of the items turn into any widgets you want, and then you can connect whatever you want from them.
You cannot connect arbitrary listeners to other menu items, whether they are action items or are in the overflow menu. Similarly, you cannot connect arbitrary listeners to anything else in the action bar that is not clearly visible widgets, such as an icon, title, tabs, navigator, etc.
If these are your widgets, you can customize the listeners. If they are not your widgets, you cannot configure listeners.
source share