Ok, you play with View specifically ActionMenuView , so try this, copy the codes into your Activity
//we declare our objects globally Toolbar tool; ActionMenuView amv;
then override onPrepareOptionsMenu , what you decide on return is your choice
@Override public boolean onPrepareOptionsMenu(Menu menu) {
now this is the key part - whenever you want to animate “three vertical points” - (your overflow), you should check the visible children (for example, if you want) to actually forget that
amv.getChildAt(amv.getChildCount()-1).startAnimation(AnimationUtils.loadAnimation( MainActivity.this,R.anim.abc_fade_in));
which gives you a basic fade animation - now you can slouch.
EDIT 1 :
In the above code, it was suggested that you didn’t add anything to the toolbar except to simply inflate the menu in onCreateOptionsMenu .
Suppose you have a sophisticated ToolBar use this sooner for your initialization
@Override public boolean onPrepareOptionsMenu(Menu menu) { for(int i =0; i < tool.getChildCount(); ++i){ if(tool.getChildAt(i).getClass().getSimpleName().equals("ActionMenuView")){ amv = (ActionMenuView) tool.getChildAt(i); break; } } return true; }
A lso where you call your amv View initialization can be in onCreateOptionsMenu or onPrepareOptionsMenu , I chose onPrepareOptionsMenu because I need readability
Hope this helps
Elltz source share